Yes there are some syntax problems; i converted this from the actual code in an attempt to show the problem. I also agree $('#divId table input') should return an array but in my code the alert returns 0. what i am attempting to show is that when I add content to the #divId, jQuery can not select the new content.
What appears to happen, is during the javascript function call which contains the $.post the content is not selectable by jQuery. After the function completes, the content appears on the screen and is then selectable by jQuery. My goal is to add content using $.post and then add event(s) to the new content. What happens is the $.post succeeds but the added content is not selectable so I cant add the events. Thanks for your help. On Nov 14, 8:04 pm, nevadaMedicaid <mrosenb...@dhcfp.nv.gov> wrote: > $.post(''strutseventname', $('form:first').serialize(), > function(data) { > $('#divId').html(data); > alert('am i visible ' + $('#divId table input).length); > $('#divId table input).click(function() { > alert('i am here'); > }); > }, "html"); > > when i execute the function above, the data in divId appears but the > click function doesnt work. i inserted the alert between inserting the > data and setting the click event. it shows that the data is not > visible to jQuery. > > It appears that jQuery cant see the new data until after the > javascript method ends. > > can you help me understand where i am going wrong? > > thanks