Here is the HTML code of a radio button
<input type="radio" class="grgrgrtgxxxxfeegrgbrg">
I am trying to check whether radio button’s name is having xx.
Here is my jquery code i have written
if($(this).prop('class').contains('xxxx'))
{
alert("Yup");
}
Please tell me the Syntax mistake in it.
containsis a jQuery method that works with elements not with strings so you must use string methods:But as someone else said you can use hasClass: