JSFiddle - React, Tailwind, and code Playground

by dafastestfingers

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'));
});