Skip to content Skip to sidebar Skip to footer

Execute Link Using Javascript

The following link opens a video when clicked: ' rel='vidbox' title=''.nl2br($

Solution 1:

It is not possible to click on a link using javascript / jquery. You can trigger the bound events using $('#m2').click() but it will not open the url. What you could do is, use document.location.href to open the page

document.location.href = document.getElementById('m2').href;

Solution 2:

Try this if you are using jQuery.

$(document).ready(function(){
    $('#m2').click();
});

Where m2 is the ID of the link to be clicked.


Post a Comment for "Execute Link Using Javascript"