Ris Ris - 4 months ago 10
jQuery Question

switching from an input to button in JavaScript

I am trying to switch the button from

input
to
button
in Javascript and I cant figure out how to put value in between the
button
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

use html instead of value

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