0

Sometimes when I work with third party scripts, I have to do things like change the name of a form in order to get their code to work properly. This works perfectly in all browsers except in IE 7.

After googling and searching stackoverflow, I have come to the understanding that in IE 7 the name attribute can only be set when creating the element (correct me if I am wrong). I want to ask if anyone can suggest a work around other than creating another form (which is huge and has several elements).

I have put it up on jsfiddle: http://jsfiddle.net/urTdq/

Code:

<form name="oldForm" id="form">
</form>
<a href="#" id="change">Change Form Name</a>
<script>
$("#change").click(function() {
$("#form").attr("name", "newForm");
});
</script> 

Let me know if you need more clarification/info. Thanks in advance!

  • It looks like IE creates a new attribute `submitName`: http://jsfiddle.net/vasek7/efCqh/embedded/result/. You need this to access the form like `document.newForm`? – Václav Dajbych Jun 28 '12 at 10:11
  • yes you are right. I need to be able to access the form like document.newForm. It creates a new attribute 'submitName' which the javascript does not recognize. – user1267503 Jun 29 '12 at 13:31
  • turns out there is not really a good way to do this. Basically, I had to rewrite the code so the form name would be a non-issue. – user1267503 Jul 18 '12 at 18:54

0 Answers0