JSFiddle - React, Tailwind, and code Playground

by Timmy Willison

HTML

<div id="test_div">
<a href="http://www.google.com" id="test_a">Google</a>
</div>

JavaScript

var a =$('#test_div a') ;
console.log(a.attr('id'));     //expected : test_a
console.log(a.attr('class'));  //expected : undefined    IE7: null, fine

a.addClass('cls1');

console.log(a.attr('id'));    //expected9 : test_a
console.log(a.attr('class'));  //expected : cls1

a.removeAttr('id');

console.log(a.attr('id'));   //expected : undefined,    IE7: null, fine
console.log(a.attr('class'));  //expected : cls1,     IE7: null, WRONG!