addEventListener submit and jQuery submit
I have form:
<form id="form1" class="f_class">
<input type="button" class="jq-button" value="jq-button"/>
</form>
And js code:
var f=document.getElementById("form1");
f.addEventListener("submit", function(){alert("addEventListener_submit");},false);
$(".jq-button").click(function(){$("#form1").submit();});
(Jsbin)
When I click to jq-button alert does not show. Why?
UPDATE
I have external js code, which use addEventListener
, and I can't change it. But in my code I want use jQuery submit. Can I combined them?
Solution 1:
just correct it to:
<input type="submit" class="jq-button" value="jq-button"/>