I have a code javascript of a action form:
<form name="myform" onsubmit="return OnSubmitForm();" method="post">
<input type="text" value="" id="type" />
<input type="submit" value="submit" />
</form>
And javascript:
function OnSubmitForm() {
var type = document.getElementById('type').value;
if(type == '1') {
document.myform.action = "index.php?type=1";
}
if(type == '2') {
document.myform.action = "index.php?type=2";
}
return false;
}
How to convert this javascript to jquery, please this ideas?
.prop('action', 'index.php?type=1')maybe?