Tested on

Examples

  1. Play with readonly attribute

      Toggle

    @readonly =  null. You can write in input field.

    $("#t1+a").toggle(
    	function(){
    		$(this).prev("input").attr("readonly", "readonly");
    	},
    	function(){
    		$(this).prev("input").removeAttr("readonly");
    	}
    );
    
  2. Remove simple attribute with removeAttr() method

    Click for remove my background-color !

    $("#t2").click(function() { $(this).removeAttr("class") });
    When I use jQuery's removeAttr() method, if you click on paragraph then his background-color is remove, except under IE.

  3. Remove the same attribute with attr() method

    Click for remove my background-color !

    $("#t3").click(function() { $(this).attr("class", "") });
    With this code, paragraph's background-color is removed, under IE too.