JSFiddle - React, Tailwind, and code Playground
HTML
<a href="www.google.com">foo</a>
<p id="foo"></p>
JavaScript
$('a').toggle(function(e) {
e.preventDefault();
// setting and attribute
$(this).attr('href', 'www.yahoo.com');
},function(e) {
e.preventDefault();
// setting and attribute
$(this).attr('href', 'www.google.com');
}).click(function(e) {
e.preventDefault();
// getting an attribute
$('#foo').text($(this).attr('href'));
});