I have these two radio buttons
<input id="119715_0" type="radio" name="119715" value="76952" data-logic="yes" required /><label for="119715_0">Yes</label>
<input id="119715_1" type="radio" name="119715" value="76953" data-logic="no" required /><label for="119715_1">No</label>
I need to find out first, if they have the data-logic attribute and then the value in order to put together an if statement for if the value is yes or if the value is no. I cant use the id's because there might be multiple buttons on the page that have data-logic so I'm trying to use $(this) so it runs on whichever is getting clicked.
I've found this link How to select elements with jQuery that have a certain value in a data attribute array but it's specific to just the type of tag. I dont know how to use it with $(this)
I have currently been messing around with
function checkLogic() {
if ($(this).attr("data-logic")) {
alert("haslogic");
}
}
$("input").click(checkLogic);
but have been unsuccessful