Context: I have an HTML page which makes use of HTML5 data- attributes. Some of my CSS styles use attribute selectors to style elements based on the value o
don't use onclick if you have the possibilites of jQuery write it like this
jQuery('input[type="button"]').click(function() {
jQuery('div').toggleClass("Test");
});
jQuery('div').click(function() {
jQuery('div').attr("data-foo", "baz");
});
in IE you always must check the javascript-error-console.
DEMO