0
b.delegate(".uipro_open_left", "click", function(){$.uiPro.open("left")});
b.delegate(".uipro_open_right", "click", function(){$.uiPro.open("right")});

I would like to call these two on page load. How could I do that? Thank you in advance for your reply. :)

Derek 朕會功夫
  • 92,235
  • 44
  • 185
  • 247
LZL0
  • 11
  • 4

2 Answers2

1

There are 2 ways of doing it

$(document).ready(function(){
    //your function
});

or simply

$(function(){
    //your function
});

Read window.onload vs $(document).ready() to get a clear understanding of when you need to call you functions.

Correcting your grammar, your functions would be called when that element will be clicked on the page. Enclosing your function definition in the snippet I have mentioned will ensure that these are invoked only when your DOM is ready.

Sorry to say this but you have a steep learning curve ahead so get started ASAP.

Community
  • 1
  • 1
Saksham
  • 9,037
  • 7
  • 45
  • 73
  • could you please help where should I put this code: "" – LZL0 Aug 25 '14 at 17:32
  • inside you `` tag(not necessarily). Before jumping to this, start reading http://www.w3schools.com/jQuery/ – Saksham Aug 25 '14 at 17:42
0

You can use $( document ).ready() function.

$( document ).ready(function() {
    console.log( "ready!" );
});
Biswajit
  • 2,434
  • 2
  • 28
  • 35