Hi, all...

I'm inserting js and html into the dom and trying to use .live() to make it
active, but I can't figure
out where to use .live() to cause the js to become after after insertion.
I've noted in part 1 the only
place I could see to try the .live() function, but it didn't work.

Any other suggestions about where I can try the .live() function in the code
below, or perhaps
another approach to make this work?  (To complicate matters, this code is
inside a modal window
with no <script> links on the page...they <script> links that control the js
code on this page are
in the parent window page.  When I do try to add <script> links to this
page, all js on this page stops working.)

Sorry this is so long and complicated, but I couldn't see how to ask the
question without providing
sufficient code.

Thoughts and suggestions?

Thanks,

Rick

The series of js code parts are: (edited for brevity)

Part 0: (Example validation routine, not working in inserted code of Part 3.
If .live() function is added here, the code doesn't work in non-inserted dom
code)
----------------------------------------------------------------------------------------------------------
$(document).ready(function() {

     $('textarea#specialDescriptionID').blur(function() {

          if       (   this.value.length == 0   )
                  {   '#specialDescriptionErrorID').fadeIn(500)   }
          else  {   $('#specialDescriptionErrorID').fadeOut(500)   };

     });
});

Part 1:
--------------------------------------
$(document).ready(function() {

     $('#editButtonID').click(function() {  //<!--- I tried using .live
here, but it didn't have any effect

          var specialID = $('.initialLastInsertedID').attr('id');
          $('#previewSpecial').hide();
          getInsertedSpecialForEdit(specialID);

     });
});

Part 2: (called from Part 1 code)
-------------------------------------
function     getInsertedSpecialForEdit(specialID) {

                var values   =   {    dsn:
 '<cfoutput>#application.dsn#</cfoutput>',
                                           specialID:     specialID    };

                $.ajax             ({   cache:          false,
                                           type:            "post",

url:
"../components/specialProcessor.cfc?method=mGetInsertedSpecialForEdit&returnformat=json",
                                           dataType:     "json",
                                           data:            values,
                                           success:      function(response)
{

                                                                   if
(   response.MESSAGE == "Success"    )

{   buildSpecialForm(response);              }

                                                                   else
(   $('#unsuccessful').empty().append(response.MESSAGE).fadeIn(500);     };

                                                              }
                  });
)


Part 3: (called from Part 2, success section)
(The js that isn't working is in the form part below and is used for
validation.  The
validation script parts have had .live applied to them without effect
----------------------------------------------------------------
function buildSpecialForm(response) {

     $('#editInsertedSpecialDivID').empty();

     var out = [];

     out.push('<p>,b>Edit Your Entry</b></p>');

          out.push('<ul style="margin-left:30px;">');
               out.push('<li>Edit your entry infomration below</li>');
               out.push('<li>To cancel your entry...</li>');
          out.push('</ul>');

     var out = [];

     $.each(response.QGETINSERTEDSPECIAL.DATA, function(i, row) {

          out.push('<form id="addSpecialEditFormID">');

              out.push('<p id="specialDescriptionEditErrorID"
class="error">Please enter a description of the special</p>');
      //---> (The html above is used for validation on the page and works
for other implementations, but for this inserted code, it doesn't respond to
to manipulation)

              (other form content here)

          out.push('</form>');

     });

     $('#editInsertedSpecialDivID').html(out.join(''));
     $(#editInsertedSpecialDivID:hidden').fadeIn(500);

}

Reply via email to