自定义数据属性:http://dev.w3.org/html5/spec/Overview.html#embedding-custom-non-visible-data
当我说"工作"时,我的意思是,如果我有这样的HTML:
<div id="geoff" data-geoff="geoff de geoff">
Run Code Online (Sandbox Code Playgroud)
将以下JavaScript:
var geoff = document.getElementById('geoff');
alert(geoff.dataGeoff);
Run Code Online (Sandbox Code Playgroud)
在IE 6中产生一个带有"geoff de geoff"的警报?
javascript html5 internet-explorer internet-explorer-6 custom-data-attribute
我有一份清单
<ul>
<li><a href="?page=4">one</li> //no 4
<li><a href="?page=7">two</li> //no 7
<li><a href="?page=14">three</li> //no 14
<li><a href="?page=72">four</li> //no 72
<li><a href="?page=201">five</li> //no 201
</ul>
Run Code Online (Sandbox Code Playgroud)
现在我想使用ajax来加载页面而不是正常的页面加载.那么如何检测用户使用jQuery点击的链接.说点像
$('id of the element clicked').click(function()({
// Load the page using .ajax()
});
Run Code Online (Sandbox Code Playgroud)
在上面的jQuery代码中,我该怎么做id of the element clicked?