I have the following HTML:
<span loopx='{"operator":"maxis"}'>hello</span>
If I want to retrieve its attribute value {"operator":"maxis"}
, I can simply use
$('span[loopx]').each(function(index) {
var attr = $(this).attr('loopx');
// attr is the string "{"operator":"maxis"}"
});
However, for the following HTML
<span loop='{"operator":"maxis"}'>world</span>
I get the following result:
$('span[loop]').each(function(index) {
var attr = $(this).attr('loop');
// attr is the string "loop"
});
I was wondering, if loop
is a special keyword within span?
Here's the test code : http://jsfiddle.net/yccheok/ghggtrfq/4/
data-*