I figured out a solution and wanted to run it by some other eyes....
Essentially the solution was to re-call the popup function.  Since
that worked, I had to also test adding future rows and ran into double
popups, so I changed the class and jquery magically remembered the old
class (as I had hoped).   Pretty cool.



<head>
  <title>Test Pop</title>
  <script type="text/javascript" src="/query.js"></script>
</head>
<body>
<script type="text/javascript">
  $(document).ready(function(){
    var i=10;
    for (i;i>=1;i--) {
     $('#start').after("<div id='" +i+ "' class='popup'>Prior to alert
code (will work) #" +i+ "</div>");
    }

  test();
  $('.popup').addClass('newpopup').removeClass('popup');
  test2();
  });

  function test(){
    i=10;
    for (i;i>=5;i--) {
      $('#'+i).after("<div id='" +i+ "' class='popup'>Replaced to
alert code (won\'t work) #" +i+ "</div>").remove();
    }
  pop();
  }

  function test2(){
    i=15;
    for (i;i>=11;i--) {
      $('#10').after("<div id='" +i+ "' class='popup'>New popups #" +i
+ "</div>");
    }
  pop();
  }

  function pop(){
    $('.popup').click(function(){
      alert(this.id);
      return false;
    });
  }
</script>

<div id="start" class='popup'>Hard code #1</div>
<div id="end" class="popup">Hard code #2</div>
</body></html>



On Nov 1, 3:25 pm, Tobias Parent <[EMAIL PROTECTED]> wrote:
> Well, you've attached the event, then gone ahead and created more divs
> and expect them to be forward-attached. You may want to look at
> something like LiveQuery.
>
> Regards,
>  -Toby P.
>

Reply via email to