jQuery API | 返回首页目录 | jQuery API 中英文对照版 |
addClass |
addClass(class)
为每个匹配的元素添加指定的类名。 返回值:jQuery 参数:
示例: $("p").addClass("selected") HTML 代码: <p>Hello</p> 结果: [ <p class="selected">Hello</p> ] Adds the specified class(es) to each of the set of matched elements. Return value: jQuery
Example: $("p").addClass("selected")Before: <p>Hello</p>Result: [ <p class="selected">Hello</p> ] Example: $("p").addClass("selected highlight")Before: <p>Hello</p>Result: [ <p class="selected highlight">Hello</p> ] |