Reputation: 986
I'm looking to hide a button containing the text 'Buy Now' using jQuery. This button is within a containing div.
Basically something like this:
$("button contains('Buy Now').parent('div').hide();
Upvotes: 1
Views: 3151
Reputation: 34107
You mean this:
API: http://api.jquery.com/contains-selector/
Hope it fits the cause, :)
OR http://jsfiddle.net/DDv8a/ try this demo
code
$("button:contains('Buy Now')").parent('div').hide();
or
$(document).ready(function () {
$("input[value='Buy Now']").closest('div').hide();
});
Upvotes: 6