JSFiddle - React, Tailwind, and code Playground
by anay1231
HTML
<div class="right-item">
<input id="male" type="radio" name="gender" value="male">
<label class="left-m" for="male"><span></span> Male </label>
</div>
<div class="right-item">
<input id="female" type="radio" name="gender" value="female">
<label for="female"><span></span> Female </label>
</div>
<script>
var s,
getData = {
cacheDOM: {
gender: $("input[name='gender']"),
age: $("input[name='age']")
},
init: function() {
s = this.cacheDOM;
this.getInput();
},
getInput: function() {
for (var i in s) {
s[i].on("click", function() {
console.log(this.getAttribute('value') + new Date().getTime())
$(this).off();
});
}
},
};
getData.init();
</script>