user2513528
user2513528

Reputation: 171

How to target a class based on the elements name

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.

Upvotes: -1

Views: 42

Answers (1)

Vikash
Vikash

Reputation: 3561

You can use this

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

It should work.

Upvotes: 1

Related Questions