[jQuery] .serialize() not working on DOM form

[jQuery] .serialize() not working on DOM form


Hi-
I am using google maps, and I have a form I am creating on the fly as
follows:
var inputForm = document.createElement('form');
inputForm.setAttribute('id','new_property');
inputForm.setAttribute('action','');
inputForm.onsubmit = function() {storeNewProperty(); return
false;};
inputForm.innerHTML = '<label for="new_name">Name</label>'
+ '<input type="text" id="new_name" style="width:100%;font-
size:10pt;" />'
+ '<input type="submit" value="Save" />'
map.openInfoWindow(latlng,inputForm);
However, once the form has been created, I am attempting to get the
data from it prior to performing an Ajax call. What I find very
problematic is that while the lines below work:
var currName = jQuery('#new_name).attr('value');
var formID = jQuery('#new_property').attr('id');
indicating that the form and its inputs can be found, the lines below
do NOT work:
var formString = jQuery("#new_property").serialize();
var formString = jQuery("#new_property:input").serialize();
Am I just using the wrong syntax? Or is this a known problem? I'm not
really wanted to serialize all my forms by hand, and no, I don't want
to use the form plugin at the moment. I really just want to know why I
can't get serialize() to work