1 Reply Latest reply on Mar 23, 2009 2:46 PM by Nick Belaevski

    The value of attribute

    choesang tenzin Newbie

      Hi!

      I am using jquery in richfaces to add an image when a user clicks somewhere (div.demo), to do that i am using ranges.

      My problem lies here

      "<img class='pin' src='./resources/pin_org.png'/>"
      


      1. it specially doesnt like the symbol ">"
      2. In the below code, i didnt show but i escape the symbol " with its corresponding hexadecimal.

      Can any body give me a hint!

      regards,
      choesang


      <rich:jQuery
       selector="div.demo"
       query="click( function(e) {
       var range, pin;
       if (document.selection){
       range = document.selection.createRange();
       var newRange = range.duplicate();
       newRange.setEndPoint( 'StartToEnd', range);
       newRange.pasteHTML("<img class='pin' src='./resources/pin_org.png'/>");
      
       }else{
       range = window.getSelection().getRangeAt(0);
       pin = document.createElement('img');
       pin.setAttribute('class','pin');
       pin.setAttribute('src','./resources/pin_org.png');
       range.insertNode(pin);
      }
      });">
      </rich:jQuery>