I have this hyperlink in anchor tag
<a href="/index.php?var1=rule-power" > Text </a>
开发者_如何学Go
Now i want that when that page is clicked i have the page with hyperlinks like
<a href="" >rule-power </a>
Is it possible that i can grab the var1 using jquery . even if its partial match it willl be good and then remove that tag
something like
NewVar =getParameter(var1);
$.find(a).withtext(NewVar).hide()
You can use Artem Barger's answer here to get the querystring variable, then you can use :contains()
to do a partial match, like this:
var var1 = getParameterByName('var1'); //from linked answer
$('a:contains("' + var1 + '")').hide();
Or, if you wanted an exact match, use .filter()
and .text()
, like this:
var var1 = getParameterByName('var1');
$('a').filter(function() {
return $(this).text() == var1;
}).hide();
精彩评论