Ris
Ris

Reputation: 1912

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"} });

Upvotes: 0

Views: 40

Answers (1)

epascarello
epascarello

Reputation: 207501

use html instead of value

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

Upvotes: 1

Related Questions