KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using the following code var newDiv = $(document.createElement("div")); var newTextBox; newTextBox = $(document.createElement("input")) .attr("type", "text") .attr("id", "textbox") .attr("name", "textbox"); newTextBox.val("text"); newDiv.append(newTextBox); alert(newDiv.html()); I get the following <input name="textbox" id="textbox" type="text"> I get the same thing with $("#textbox").val("test"); Using newTextBox = $("<input/>"); Doesn't help either Where is my value? EDIT: SOLTUION So, further up in the stack I was converting the DOM I built to a string and since - like munch mentioned - the dynamic value doesn't get added to the tag, it wasn't showing up. Thanks for the help
Tags (comma-separated)
Save Edits
Cancel