📜  jquery attr - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:37.744000             🧑  作者: 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"
});