jQuery: Select all readonly input type textbox

In this short post, find jQuery code to select all readonly input type textboxes present on the page.

$(function(){
    $(":input[type=text][readonly='readonly']").val("");
});

However, if you have single readonly textbox element, then select it using its ID. And if you want to exclude all readonly input type textboxes from selection, then use below jQuery code.

$(function(){
    $(":input[type=text]:not([readonly='readonly'])").val("");
});

The only difference is that ":not" selector is used to exclude readonly input type elements.

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...