$("" /> $("" /> $(""/>

How to target a class based on the elements name

43 Views Asked by At

How do I target a class based on its name:

<input type="submit" name="addtocart" class="addtocart-button" value="Add to Cart" title="Add to Cart">
$("[name="addtocart]").removeClass('addtocart-button');

This is what I thought how to do it, but doesnt work.

1

There are 1 best solutions below

0
Vikash On BEST ANSWER

You can use this

$("input[name=addtocart]").removeClass('addtocart-button');

It should work.