Ris Ris - 1 year ago 42
jQuery Question

switching from an input to button in JavaScript

I am trying to switch the button from

in Javascript and I cant figure out how to put value in between the
tag and the right syntax.How can I accomplish this ? Thanks

here is the input button that I have

var somebutton = $("<input/>", { type: "button", value: "Save" });

i'd like something like this, but its not a right syntax

var somebutton = $("<button/>", { type: "button", {"Save"} });

Answer Source

use html instead of value

var somebutton = $("<button/>", { type: "button", html: "Save" });