1 Reply Latest reply on Sep 10, 2008 9:20 PM by rituraj_tiwari

    execute javascript function on page load

    ajanz

      how can i execute a javascript function on page loading?


      i want to set a h:inputtext field with the local user name

        • 1. Re: execute javascript function on page load
          rituraj_tiwari

          I'll tell you what I do in my environment where I use XHTML templates for my view:



          1. Make sure richfaces namespace is included in your root tag: xmlns:rich="http://richfaces.org/rich"

          2. Add in jQuery library bundled with richfaces (which is bundled with Seam): <rich:jQuery query="undefined"/>

          3. Inside a <script> tag, define your onload function to do what you need it to do:



          jQuery(document).ready(function()
          {
           ...
          }




          Hope this helps.


          -Raj