show-notice
hide-notice

Thursday, 15 August 2013

Select all readonly input type textbox using jquery


Introduction:

In this short post, find jQuery code to select all readonly input type textboxes present on the page.
Example:
$(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.

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com