开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜