i have a small problem with a jquery click trigger. in my index.php i have at the begining of the page:
if ($oauth == 'yes') {
echo "test";
?>
<script>
$(document).ready(function(){
$("#ajax").trigger('click');
});
</script>
<?php
}
then in the body:
<a class="ajax" id="ajax" href="#" title="Sync">click</a>
<div style="display:none;">
<div id="login_user">content here...</div>
</div>
<script>
$(document).ready(function(){
$(".ajax").colorbox({width:"400px", height:"280px", inline:true, href:"#login_user"});
});
</script>
if i click on the link i get the lightbox, but if the php condition is true nothing happens, the links doesn't get triggered but the test
gets echoed out.
any ideas on how to debug this?
thanks
I think the problem is that you have 2 $(document).ready
functions and the first one will be triggered first.
So the #ajax
element isn't a colorbox yet. Try to switch the document ready functions