📌  相关文章
📜  jquery 添加属性 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:32.838000             🧑  作者: Mango

代码示例4
$( some_item ).attr( "id", "some-id" );
// for setting multiple attributes, it's similar to the css() property. However, quotes are not always required for attr()
$( some_item ).attr({
  id: "some-id",
  // or others.
  title: "Opens in a new window",
  // attributes which contain dash(-), should be covered in quotes.
  "data-value": "internal link"
});