What am i doing wrong? Please see my simplified Fiddle here:
http://jsfiddle.net/a2q815fq/4/
function change() {
$('#mainmenu3').prop('data-badge','444');
}
Should change the data-badge to "444", but doesn't?!
I think i'm doing something really stupid, but i can't see it!
EDIT: Thanks for the answers. I think, something in the Fiddle does not work, because an simple "alert('test')" does not work?! Should there be a different call to the function "change()"?
EDIT AGAIN: thx, attr() is working, while prop() does not. BUT, if i choose to remove it, removeAttr() should work for it? But doesn't - see here: http://jsfiddle.net/a2q815fq/19/
LAST-EDIT: As SultanBaby mentioned, the selector was not correct. Should be: #mainmenu3 a[data-badge]! THANKS guys, you made my day!