Results 1 to 2 of 2

Thread: Java script reloading the page?

  1. #1
    Join Date
    Feb 2012

    Java script reloading the page?


    I have a question to those in the know here:

    I'm trying to load a script that would dynamically display a telephone number for each selected location on the site, but when I use this script, it reloads the entire page and then displays ONLY the telephone number, instead of loading the number inside the page:

    <div align="center"><script>jQuery(window).load(function(){document.write(jQuery(".fulfiller-contact-telephone").text())});</script> </div>
    What am I doing wrong here?

    Thanks in advance for your help

  2. #2
    Join Date
    Feb 2012
    "Note: Try to avoid using document.write() in real life JavaScript code. The entire HTML page will be overwritten if document.write() is used inside a function, or after the page is loaded."
    From w3schools.
    Instead, write the content inside an element.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center