I have multiple inputs like that (unknow number)
<INPUT id="ctl00_ContentPlaceHolder_txtSOPurchaserSapID" onkeydown="return scriptReadonly();" style="WIDTH: 150px" name=ctl00$ContentPlaceHolder$txtSOPurchaserSapID>
there are not on the same page of the app, the id's and the names are dynamically loaded i cannot add a class because there are so many and i don't know the location of all this inputs.
My question is, can i attach a attribute of readonly with jquery to this inputs by the only thing that is the same on each of them
onkeydown="return scriptReadonly();
Yes, you can, using an attribute equals selector:
Live Example:
If the text of the
onkeydown
attribute varies a bit, you can usefilter
instead to make things more fuzzy:Live Example: