.submit() not working in IE

Im trying to submit a form in IE, but the submit doesnt fire in IE. I have tried Chrome and Firefox which works fine.

My code is kinda simple:-
		$(document).on("click","#btnRemoveSelectedImages",function () {
			var r = confirm("Are you sure you wish to remove the selected images?");
			if (r == true) {
				var newForm = $('<form>', {                
					'action': 'backend.php',
					'target': '_self',
				newForm.append($('<input>', {
						'name': 'frmName',
						'value': 'RemoveImages',
						'type': 'hidden'
				var noImgs = 0;
				$(".claImageSelected").each(function( index ) {
					newForm.append($('<input>', {
						'name': 'imgName_' + noImgs,
						'value': $(this).data("imgFilename".toLowerCase()),
						'type': 'hidden'
				newForm.append($('<input>', {
					'value': "Submit",
					'type': "submit"
				newForm.append($('<input>', {
					'name': 'NoImages',
					'value': noImgs,
					'type': 'hidden'


Open in new window

It seems to generate the HTML fine, and I can see it if I call:-

Open in new window

However it seems to be missing the <Form> header and footer tags, which Im unsure why this is.

Ive read a few articles which suggest adding the form to the body then submitting it, which I have tried by:-

Open in new window

But again get the same error.

Any suggestions?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rainer JeschorCommented:
could you simply try and replace (in your above posted code)

Open in new window


Open in new window

That should work.
I also added on top a call to prevent the default event handler
$(document).on("click","#btnRemoveSelectedImages",function (e) {

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Julian HansenCommented:
Rainer's solution is correct - you are creating the form but unless you actually add it to the document it does not exist in the DOM and therefore submitting it will have no effect.

This sample uses your code with a document append and posts to a script that dumps the $_POST (http://www.marcorpsa.com/ee/t1169.html)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.