javascript - Safari does not trigger form Submit -
for project got 2 select-formfields sent via jquery trigger("submit"); works in firefox und chrome, in safari nothing happens.
this html-code:
<body> <form action="http://google.de" target="_blank" style="display: inline;" method="get"> <select class="bstarch2" data-role="none" name="q"> <option value="none">please choose</option> <option value="a: worked">a</option> <option value="b: worked">b</option> </select> </form> <select class="bstarch" data-role="none"> <option value="none">please choose</option> <option value="http://google.de">google</option> <option value="http://en.wikipedia.org">wikipedia</option> </select> <form action="" method="get" target="_blank" id="mmform"></form> </body>
and javascript code:
$("body").on("change", ".bstarch", function () { if ($(this).val() != "none") { $("#mmform").attr("action", $(this).val()); $("#mmform").trigger("submit"); $(this).val("none"); } }); $("body").on("change", ".bstarch2", function () { if ($(this).val() != "none") { $(this).parent().trigger("submit"); $(this).val("none"); } });
i got jsfiddle here, , not work safari: http://jsfiddle.net/p7vnx/
thanks help.
edit: got it: seems safari blocks form submit popup. code correct, gets blocked safari... can't answer question because reputation small.
try use jquery in place of $ ,
jquery("body").on("change", ".bstarch", function () { if (jquery(this).val() != "none") { jquery("#mmform").attr("action", $(this).val()); jquery("#mmform").trigger("submit"); jquery(this).val("none"); } });
Comments
Post a Comment