The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript load a function on page load

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #42315

    hi everyone
    i want to run a function in javascript when page loads. but after loading the page nothing happens! but if i manually refresh the page the function runs! i used these two methods but i dont know where is my problemo! :

    $(window).bind(“load”, function() {
    and this:
    window.onload = showOnEdit;// showOnEdit is my function name


    you can look for when the document is ready:

    $(document).ready(function() {
    //your javascript here…

    or you can do it by calling onload on the body and then your javascript function. you seem to be missing the “” and the () when you call the function. this sould work fine:

    hope this helped..


    @CarlRosell thanks Carl, i will test “document ready” but i cant test the second one because my site is WordPress.


    No prob.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.