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>