TypeError: '[object HTMLInputElement]' is not a function (evaluating 'elem[ type ]()') in jQuery form.submit()

后端 未结 3 1761
说谎
说谎 2021-02-20 00:01

Has never run into this issue? I\'m getting this error in the latest release of jQuery. I tried with version 1.6.2 and there is no issue.

TypeError: \'[object HT         


        
相关标签:
3条回答
  • 2021-02-20 00:32

    I hade a similar issue with safari recently on a bit of javascript to submit a form. Turned out to be due to the submit input element having the name="submit", which was conflicting causing it to return it as not being a function.

    0 讨论(0)
  • 2021-02-20 00:40

    I have found that this error will occur when using the onclick attribute to call a JavaScript function with the same name as either the id or name attributes on an input element:

    <input id='foo' name='fooName' onclick='foo();'> <!-- BAD: id matches function -->
    
    <input id='fooId' name='foo' onclick='foo();'> <!-- BAD: name matches function -->
    
    <input id='fooId' name='fooName' onclick='foo();'> <!-- WORKS! -->
    

    This behavior occurs irrespective of input type.

    0 讨论(0)
  • 2021-02-20 00:45

    This usually happens if any of your input tag's name is submit. For example,

    <form id="frm">
        <input type="submit" name="submit" value="Post" />
    </form>
    

    On the above code, document.getElementById("frm").submit represents the input element. When you apply () to submit It shows this error.

    0 讨论(0)
提交回复
热议问题