I want to throw an alert when an input has a \'readonly\' attribute. I have tried this:
if($(\'input\').attr(\'readonly\') == \'readonly\'){ alert(\"foo\"
Since JQuery 1.6, always use .prop() Read why here: http://api.jquery.com/prop/
if($('input').prop('readonly')){ }
.prop() can also be used to set the property
$('input').prop('readonly',true); $('input').prop('readonly',false);