if element has class user i need to click on a link. the alert executes but link don't work.
function gotoproduct()
{
var id = $(this).attr('id');
if($(this).hasClass("user"))
{
alert(""); // alert works.
$('#mainnavi li a[title = "users"]').click(); // it's not working
}
else
{
window.location.replace("../"+tab+"/product.php?subjectid="+id+"");
}
}
html:
<div id="mainnavi" title="">
<ul style="margin-top:10px;">
<li><a title="phones" href="../phones/firstpage.php" >گوشی</a></li>
<li><a title="users" href="../users/firstpage.php" >گوشی</a></li>
</ul>
</div>
You can try this:
Demo: http://jsfiddle.net/a6NJk/652/
try to see request by debugging. it is redirecting :)
there is another alternative way you can do this
like this:
sample demo : http://jsfiddle.net/a6NJk/651/