Replacing img src in textarea using jquery from a pop-up window

Replacing img src in textarea using jquery from a pop-up window

I'm trying to replace the textarea and input box image source in the parent window using jquery from a pop-up window. The text in the input box changes without any trouble, however the text in the textarea box remains unchanged.

Here's the code for the parent window:

  1. <textarea cols="100" rows="20" class="editor">
  2.     <a href="">
  3.         <img src="image.jpg" alt="replace image source in this textbox" />
  4.     </a>
  5. </textarea>

  6. <input type="text" value="image.jpg" maxlength="255" MultiLine="false" Class="inputBox" style="width:875px;" />

  7. <a href="/PopUpBox" class="popup">Click Here To Add An Image/s</a>

  8. <script type = "text/javascript">
  9.     $('.popup').click(function (event) {
  10.         event.preventDefault();
  11.$(this).attr("href"), "popupWindow", "width=750, height=800, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes");
  12.     });
  13. </script>

Here's the code for the pop-up window:

  1. <div class="selectButton">
  2. <input id="select" class="selectImage" type="button" data-imagepath="image2.jpg" value="Select">
  3. </div>

  4. <script type = "text/javascript">
  5.     $('.selectImage').live("click", function (e) {
  6.         var selectImage = $(this).data("imagepath");
  7.         window.opener.$(".editor img").attr("src", selectImage); // can't change img src in textarea box
  8.         window.opener.$(".inputBox").val(selectImage);
  9.         self.close();
  10.         e.preventDefault();
  11.     });  
  12. </script>

Any ideas why this isn't working?