mercredi 14 mai 2014

How to disable enter keypress event in Textbox in ASP.Net MVC?


Vote count:

0




I have a view like this



<input id = "txtQty" type = "text" value = "<%= Model.Qty %> class = "qtyTxt" onfocus = "$('#oldValue').val(this.value)" onchange = "updateQty("<%= Model.Id %>, this.value %>)" />

...
<button class = "ui-button" onclick="deleteItem(<%=Model.Id)"> Remove </button>


Javascript



function updateQty(id, qty)
{
//...
}

function deleteItem(id)
{
//...
}


Now, my problem is whenever I enter value in the textbox and press enter key it called both method one after another in js. Mouse click is working fine but enter keypress is not working as I expected. I need to call only updateQty method when I press enter key. How can I achieve this?


TIA



asked 1 min ago

Lakhae

183





Aucun commentaire:

Enregistrer un commentaire