Form onsubmit is not called at multiple intervals each containing an input

work:

<form class=filter onsubmit="alert('submit');">
    <span class=a></span>
    <span class=b> <input type=text name=b /> </span>
</form>

      

does not work:

<form class=filter onsubmit="alert('submit');">
    <span class=a></span>
    <span class=b> <input type=text name=b /> </span>
    <span class=c> <input type=text name=c /> </span>
</form>

      

By work, what I mean is that when I type some text and hit enter, the onsubmit (simple warning) form is called. Why doesn't it work in the second case? What's the best way to fix this or work around it? I could add a separate onchange event for each html login, or add events via javascript / JQuery. Is this the best approach?


I have a "table" built from divs for rows and spaces for records. The form is one row in the table. Wrapping the inputs inside the slots makes the formatting (mostly column widths / spacing) more uniform. The actual entry element is then set to 80% of the span.

+3


source to share


2 answers




+3


source


Where is your submit button?

I just tried this in jsfiddle and it worked :



<form class=filter onsubmit="alert('submit');">
    <span class=a></span>
    <span class=b> <input type=text name=b /> </span>
    <span class=c> <input type=text name=c /> </span>
    <input type='submit' />
</form>
      

+2


source







All Articles