I want to find the match in the link and then trigger the click event on it.
jquery,
var request = 'id=10';
var test = $("a").filter("[href*=" + request + "]").trigger('click');
html,
<a href="http://website.come/folder/file.php?id=10&ajax=true">1</a>
<a href="http://website.come/folder/file.php?id=20&ajax=true">2</a>
<a href="http://website.come/folder/file.php?id=30&ajax=true">3</a>
error message,
unrecognised expression:[href*=id=50]
I tried with this one below but failed too,
var test = $("a").filter("[href*=http://website.come/folder/file.php?id=10&ajax=true]").trigger('click');
How should the expression be in this case?
If possible, I would like to match the whole thing, like,
http://website.come/folder/file.php?id=10&ajax=true
Is it possible?
Wrap the request match with quotes:
$('a[href*="id=10"]').trigger('click');