How to convert this onclick() function to onload()

jquery, onclick, onload

Solution

There are multiple options for onload event.

In HTML

<body onload="myFunction('parameter')">

In Javascript

window.onload=function(){
myFunction('parameter');
};

In JQuery

$(document).ready(function(){
      myFunction('parameter');
});

Problem

Possible Duplicate: How to make onclick automatically through onload function So I have the following function which is being called when I click a button. Here is the code: ``` <a href="#" role="button" onClick="myFunction('parameter')"> ``` How can I call this function as soon as page is loaded? I tried onLoad function but doesn't seem to work.

Original source

Related problems