3 Replies Latest reply: Apr 5, 2013 6:54 AM by fac586 RSS

    On click add / remove class on textarea

    932225
      I have two textarea, :P1_LOC_A and :P1_LOC_B. on click on :P1_LOC_A, i want to addClass say "lov_focus" (which make the textarea focus)
      and on click of some where else on the page , i want to removeClass "lov_focus" (which will remove the textarea focus)
        • 1. Re: On click add / remove class on textarea
          fac586
          oracle_student_777 wrote:
          I have two textarea, :P1_LOC_A and :P1_LOC_B. on click on :P1_LOC_A, i want to addClass say "lov_focus" (which make the textarea focus)
          and on click of some where else on the page , i want to removeClass "lov_focus" (which will remove the textarea focus)
          What are you actually trying to do?

          There is already a built-in pseudo-class<tt>:focus</tt> pseudo-class automatically available for use as a selector in CSS and jQuery.
          • 2. Re: On click add / remove class on textarea
            932225
            suppose i click on textarea, it gets highlighted with blue border (what happens is class is added "lov_focus"). now what i want is when i click somewhere else
            in the page other then the text area, highlighted blue border should be removed (means removeClass "lov_focus" which is added earlier)
            • 3. Re: On click add / remove class on textarea
              fac586
              oracle_student_777 wrote:
              suppose i click on textarea, it gets highlighted with blue border (what happens is class is added "lov_focus").
              You don't have to add a class. The browser automatically tracks which element has input focus, and styling can be applied to this element using the <tt>:focus</tt> pseudo-class selector. See the example in the linked document.
              now what i want is when i click somewhere else
              in the page other then the text area, highlighted blue border should be removed (means removeClass "lov_focus" which is added earlier)
              This will also happen automatically if the <tt>:focus</tt> pseudo-class selector is used.

              Do you know how to use CSS in APEX? What APEX version are you using?