返回值:jQueryjQuery.data(element, key, value)
概述
在元素上存放數(shù)據(jù),返回jQuery對(duì)象。
注意:這是一個(gè)底層方法。你應(yīng)當(dāng)使用.data()來(lái)代替。
參數(shù)
elementString
要關(guān)聯(lián)數(shù)據(jù)的DOM對(duì)象
keyString
存儲(chǔ)的數(shù)據(jù)名
valueAny
將要存儲(chǔ)的任意數(shù)據(jù)
示例
jQuery 代碼:
jQuery.data(document.body, 'foo', 52);
jQuery.data(document.body, 'bar', 'test');