i have this situation:
<div class="cont_picture">
<?php echo "<a id=\"mine_click\" href=\"#\" >a test</a>"; ?>
</div>
<div id="number"><?php echo $number; ?></div>
this will give me something like: a test 123456 (the link is as an example only)
then i have the jquery:
$('#mine_click').live('click', function() {
var strtalentnum = $('#number').text();
$('#mine').trigger('click');
})
and;
if($strtalentnum){
alert ($strtalentnum);
}
but the alert doesnt work.
Any ideas how to get this working? see jsfiddle
thanks
You have defined
strtalentnuminside#mine_clickclickevent handler and try to access it outside the handler which is out of scope. If you want to access it outside the handler then define it in the outer scope or glbally.Also the variable you are trying to alert begins with
$. I think its a typo.Working demo