Appended content using jQuery 'append' is not submitted?

Posted by YourMomzThaBomb on Stack Overflow See other posts from Stack Overflow or by YourMomzThaBomb
Published on 2010-03-21T21:18:52Z Indexed on 2010/03/21 21:21 UTC
Read the original article Hit count: 172

Filed under:
|
|

I'm new to jQuery so this may be a real simple answer. I have a ASP.NET project that I'm trying to dynamically add content to a span element by typing into a text box and clicking a button. Sounds simple right? Well, I can get the content to added, but when the form is submitted the span element is still empty? Why is the new data not submitted? What step am I missing? Please help. Here's some sample code:

< span id="tagContainer" runat="server">< /span>
< input type="text" name="tag" id="tag" / >
< input type="button" name="AddTag" value="Add" class="button" onclick="addTag();" / >

function addTag() {
   if ($("#tag").val() != "") {
      $("#tagContainer").append('$("#tag").val()');
      $("#tag").val("");
   }
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about AJAX