Here is the DEMO
HTML CODE as
<div id="me"></div>
<a id="ok" href="">OK</a>
jquery code:
var tr = '';
for (var i = 0; i < 100; i++) {
tr += '<tr><td>a' + i + '</td></tr>';
}
var table = '<table>';
table += tr;
table += '</table>';
$('#me').append(table);
$('td').each(function(index, value) {
if ($(this).text() == 'a50') {
$(this).addClass('yellow').attr('id', 'search');
}
});
$('#ok').attr('href','#search');
$('#ok').trigger('click');
TO DO: In a table in each td there is data.I am trying to search the data. if the search data is found,the td is added with attribute class as yellow and id as search. I have an anchor tag. The anchor tag is to simulate: when it is clicked then the windows is to be scroll to that location.I also added internal link to anchor tag.
Now,the Anchor tag is to be click so that the page is navigate to href location
PROBLEM The page is not navigating to internal link. Is there any problem with anchor tag not triggering click? But is navigated when i click the anchor tag with mouse