jQuery(html, props)


version 1.4 以降

解説

HTML文字列から、jQueryオブジェクトを生成します。
要素の属性をハッシュで指定することができます。

引数

  • html
    String: HTML文字列
  • props
    Object: 属性値のキーと値のハッシュ

戻り値

  • jQuery: jQueryオブジェクト

関連


例1:<a href="http://jquery.com/">jQuery</a> という a 要素のjQueryオブジェクトを生成し、表示します。

$("<a>", {
    href: "http://jquery.com/",
    text: "jQuery"
})
.appendTo("#test_result");