How can I activate an internal page link with Javascript?

user498651 picture user498651 · Nov 5, 2010 · Viewed 10.4k times · Source

How do you activate a link when the page loads using javascript?

I am trying to open a lightbox when the page loads, here is the link I am trying to activate.

<a href="#home_video" rel="facebox">Replay Intro</a>

Answer

Liam Bailey picture Liam Bailey · Nov 5, 2010

All you need to do is

<script type="text/javascript">   
 $(document).ready(function() {
    $("#linkID").bind('click',function()
    {
    $(this).facebox();
    })
    $("#linkID").click();
    })
</script>