Some simple examples use native js and jQuery to change div attributes and reset them at will. The code is as follows:
Function passes parameters to change the value of any attribute of Div < input type="text" value="background" name="styleName" />
Enter "Attribute Name" and "Attribute Value" in the upper input box, click the OK button See the effect.
$(function(){
$("button:first").click(function(){
var styleName= $("#outer").find("input:first").val();
var styleVal = $("#outer").find("input:last").val( );
$("#div1").css(styleName,styleVal);
})
$("button:last").click(function(){
$("# div1").removeAttr("style");
})
})
Enter "attribute name" and "attribute value" in the upper input box, and click the OK button to view the effect.