There is a markup:

<form method="POST" id="add_rule_form"></form> <table class="list issues" style="margin-top: 20px"> <tbody id="table_notification_body"> <tr id="new_rule_row" class="hascontextmenu odd "><td class="number"><input type="text" name="sequence" id="sequence" value="613" form="add_rule_form" onkeyup="localStorage.setItem('sequence_is_change', 1);"></td><td class="project"><span class="jump-box-arrow"></span><select name="project_quick_jump_box" id="project_quick_jump_box" form="add_rule_form"><option value="-1">Выбрать проект...</option></tr> </tbody> </table> 

Using jQuery, I'm trying to serialize a form:

 var data = $("#add_rule_form").serialize().split("&"); 

As a result, only this is in data :

 [ 0: "", length: 1 ] 

And this happens only on IE9, in other browsers everything is fine. How can I fix this problem?

  • one
    so your form is closed before the table block Oo. Add content inside the form. It is strange that in other browsers everything is fine - alexoander
  • @alexoander, so the elements have the form attribute, but as far as I understand it is not supported in IE - S.Ivanov
  • as if this is not particularly important, because You are using a jQuery selector. $ ("# add_rule_form"), which returns an empty form and has nothing to serialize it. In new browsers, it is possible it will push content with form attributes inwards - alexoander

1 answer 1

As I described in the comment, the error is possible in that the form is closed before the content of the form begins.

$("#add_rule_form") selector will return an empty form, and serialization will quite correctly return the result 0, since nothing to check. Perhaps in other browsers there is some logic that assigns content with form attributes inside the form itself, but IE is not capable of this.

The solution is quite simple - stuff the content inside the form and check that the selector returns an object with childElement.length != 0