Reputation: 3
I've small problem with trigger (jQuery). In my <table>
, i would like if I click on my <tr>
it ove my href.
See my code/test at http://jsfiddle.net/vPEAn/
$('tr').click(function(){
$(this).find('.link').trigger('click');
});
Any idea what the problem is?
Upvotes: 0
Views: 303
Reputation: 2761
You can store the url to a variable:
$('tr').click(function(){
var url = $(this).find('.link').attr('href');
window.location = url;
});
Upvotes: 0
Reputation: 95047
The problem is manually triggering a (jquery)click event on an anchor tag doesn't perform the default action. Instead, just do a normal javascript redirect.
$('tr').click(function(){
window.location.href = $(this).find('.link').attr("href");
});
Upvotes: 2