How do I directly modify a property of an HTML element using jQuery?
How do I directly modify a property of an HTML element using jQu开发者_StackOverflow中文版ery?
$("selector").attr("attr", "value");
This page describes more
To set an arbitrary element attribute value:
$("#element-id").attr("attribute-name", "value");
HTML elements have "attributes" and you can edit their values using the attr function in jQuery.
.attr("someAttribute")
returns the value of an attribute.
.attr("someAttribute", "some value")
sets the value of an attribute.
精彩评论