JSFiddle - React, Tailwind, and code Playground

by Shaunak Deshpande

HTML

<input type="radio" name="test" onclick="setAttributes(document.getElementById('submit'), {'class': 'first', 'href': 'http://www.google.com'});">First<br/>
<input type="radio" name="test" onclick="setAttributes(document.getElementById('submit'), {'class': 'second', 'href': 'http://www.stackoverflow.com'});">Second<br/>
<a id="submit" class="" href="">Click Here</a>

JavaScript

function setAttributes(el, attrs) {
        for(var key in attrs) {
            console.log(key+' '+attrs[key]);
            el.setAttribute(key, attrs[key]);
        }
    }