jqueryhtml.textboxfor

How to find all readonly fileds using jQuery?


I have several text boxes with attribute 'readonly'

@Html.TextBoxFor(model => model.ClientNumber, new {@readonly = "readonly", @class ="message-label"})

How can I find all of them using jQuery (to enable similar behavior on keydown event)?


Solution

  • well use attribute seletor..

     $('input[readonly="readonly"]').keydown(function(){
         .....
     });
    

    or just

    $('input[readonly]').keydown(function(){..});