This is what I tried in JSFiddle
. It's working fine in JSFiddle. I am able to access
attr()
that is associated with CSS. But when I try this in Firefox and Chrome the browsers are not ready to accept it. Firefox immediately discards this property, and Chrome strikes it and adds a warning symbol. Why are these browsers not accepting this attr()
? How does JSFiddle accept it?
$('div').hover(
function()
{
$(this).attr('data-content',':over');
alert($(this).attr('number'));
},
function()
{
$(this).attr('data-content',':out');
alert($(this).attr('number',200+parseInt($(this).attr('number'))));
}
);
div::after
{
content: attr(data-content);
top: attr(number px);
}