Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
dear sir or madam,
I need to visible the submit event of enter button when selceting a submit button and in all form submit event of enter button is disable.
I am able to disable submit event of enter button in whole form. so how to visible it for submit button.
java script to disable submit event of enter button.
<script>
$(function() {
$("form input").keypress(function (e) {
if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
$('button[type=submit] .default').click();
return false;
} else {
return true;
}
});
});
</script>

please help me..
Posted
Comments
nice_hand23 9-Aug-14 10:36am    
javascript or jquery?
and...
do you mean that there should be a visible event, when someone wants to click a disabled button? or do you want that a disabled button doesn't look like an enabled one?

1 solution

if you mean if user pressed enter when submit button is focused?
this property can help you


JavaScript
$("form input").keypress(function (e) {
 alert(event.target)
if(event.target == yoursubmitbutton)
{
//here u can submit the form
return;
}

});
});
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900