42
返し:jQueryのデータ()undefinedを返し、ATTR()私は次のコードを有する整数
alert($embellishment.data("embellishmentId"));
alert($embellishment.attr("data-embellishmentId"));
最初の通知を第二警告が整数、3
を返し、一方、undefined
を返します。
私はjQueryのバージョン1.7.2(data
はバージョン1.4、私は信じていながら添加した)
なぜこれがあるを使用していますか?適切な値が返されない場合は、data()
を使用する必要がありますか?
ここでそれをしないソースコードがあります。 'rmultidash'は' rmultiDash = /([AZ])/ g; ' – Esailija
http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-nonです。データとの可視データ - * - 属性 – Alex
みんな、jQueryはこれを長い間行ってきました。 CSSの属性を見てみましょう。 CSSスタイルを表示する場合は、引用符で囲まれていない属性にcamelCaseを使用します。 css({'padding-top': '40px'}); '$ {'elem'};} { 。 – TerranRich