Categories

Unclosed <P> before <form> breaks form submit in IE when using jQuery

If you are facing issues with form submits using jQuery in IE because of unclosed <P> tags.

Try this:

var form = $(document).find(“form”);

var frm = form.parent().html();

if(frm.toLowerCase().indexOf(‘form’) > -1 && frm.toLowerCase().indexOf(‘/form’) == -1) {
var frmTag = frm.substring(frm.toLowerCase().indexOf(‘<form’), frm.toLowerCase().indexOf(‘>’)+1);
var rest = frm.substring(frm.toLowerCase().indexOf(‘>’)+1);
form.parent().remove();
form.before(frmTag);
form.prepend(rest);
}

jQuery.append() Behaviour

jQuery.append() behaves a differently in different situations. It sometimes moves the contents from the DOM to the new location where it is appended and sometimes it clones it (keeping a copy of the dom element in its original location). I stumbled upon this when trying to fix an issue with <form> submit. The content I [...]