0

This is my js function which run succesfully on chrome, safari, firefox. But on ie isn't working. How to solve it?

function submitThis(name){
    var form= document.getElementsByName(name)[0];
    form.submit();
    return true;
}
kamal
  • 1,093
  • 6
  • 19
  • 34
  • How IE version you tested? – SlyBeaver Jul 23 '14 at 06:44
  • I tested it now in IE. My code work: HTML: `

    ` Javascript: `var form= document.getElementsByName('someform')[0]; form.submit();` It work on IE>=7
    – SlyBeaver Jul 23 '14 at 06:48
  • 2
    I chose the wrong duplicate, I misread `getElementsByClassName` check this question see if helps http://stackoverflow.com/questions/278719/getelementsbyname-in-ie7 – elclanrs Jul 23 '14 at 06:49
  • i couldnt solve my problem you sent me. I tried document.getElementById method but doesnt work also – kamal Jul 23 '14 at 06:54
  • Maybe the problem is somewhere else then. Are you sure the element exists by the time you run the script? I'd suggest you create a demo in http://jsfiddle.net, and get it to reproduce the error, then open a new question, post the code that failed, and tell us what version of IE fails. – elclanrs Jul 23 '14 at 06:56

0 Answers0