1 Reply Latest reply on Oct 1, 2009 9:42 AM by blabno

    jquery not firing blur event

    willie slepecki Newbie

      on my page, im using the jquery.fields plugin to use the movenext and moveprevious functions.  i have a zip code field with a valuechangelistener attached.  it also has an a4j:support method attached to the onblur event. that support rerenders the city and state outputText fields with the values generated by the valuechangelistener event.

      my problem is when you run the movenext jquery method, it fires the valuechangelistener but not the a4j:support.  whats weird is when its your on the next field and you click on previous, to go back to the zip code field, the onblur event of the zip field fires and the fields are rerendered correctly.

      i tried adding the


      function to my javascript just before the movenext but it still doesn't work.

      any ideas?  im going to try the richfaces forum too

        • 1. Re: jquery not firing blur event
          blabno Master

          First of all your selector is wrong for it is not preceeded with hash (should be '#zip').

          Also note that jQuery has problem with JSF-like ids separated with colon (:).
          If your id is 'someForm:zip' then selector should be '#someForm\:zip'.

          You can try one of following :

          <input type="button" value="Blur" onclick="jQuery('##{rich:clientId('zip').replaceAll(':','\\\\\\\\:')}').hide()"/>

          or :

          <rich:jQuery query="blur()" selector="#zip" name="blurZip"/>

          which will create JS function named blurZip and you could attach it somewhere.

          or :

          <input type="button" value="Blur" onclick="jQuery(#{rich:element('zip')}).hide()"/>