You need a 'name' attribute on your inputs.
On Mar 2, 3:56 pm, Matt <matt.critch...@gmail.com> wrote: > Hi, > > If i create a dynamic form(requirement for a project) serializeArray() > or serialize() doesn't seem to work. Is there any reason why this is? > > Here's a simple example. neither function returns anything. > > $(document).ready(function(){ > var sform = $("<form id='searchForm'></form>"); > var box = $("<input id='searchBox' > type='text'></input>"); > var button = $("<input id='searchButton' type='submit' > value='Search'></input>"); > sform.append(box).append(button); > $("body").append(sform); > $("#searchButton").bind("click",function(){ > handleSubmit(); > return false; > }); > function handleSubmit(){ > var formData = jQuery(":input").serialize(); > alert(formData); > } > });