Thanks for your help and Interest.
I think it is not problem like time controlling.
because $(div#add_comments).click does not care of loading of
insertBefore();.
Actually I am clicking on a button which is inserted by insertBefore()
and then it perform onClick.
if you see this url:
http://www.learningjquery.com/2008/03/working-with-events-part-1
you see the first example that once alert(); is performed ok.
and then it does not work but later in this tutorial the author
switch to another example and that
does not fall in my understanding... there are two ways of solving
this problem
1- Event Delegation
2- Re-binding
How these two will work that i don't understand.
Any how you really help me to further explore these two.
Thx... if u can explain how to related any one with my setuation that
would be very nice
thx again ...
On Aug 19, 8:48 pm, Olivier Percebois-Garve [EMAIL PROTECTED]
wrote:
have look
athttp://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...
Probably your code runs first $(div#add_comments).click( ... then it
insert the new html. So when $(div#add_comments).click runs, there is
nothing to be bound.
Then the new html is inserted and is not modified.
Olivier
Tahir wrote:
i have this problem when i call a function onClick after
insertBefore();
when i click a button it insert TEXT AREA, SEND BUTTON at right place.
and then at that i apply some functionality like ALERT(ABC); at
that inserted BUTTON and it does not work.
Help me out of this ... plz soon.
* Code is OK if i does not put it in this snario. Only when i
dynamically insert some tage and apply an event to those it does not
work
-- OK (it inserts at relevant position)
--
$(div#sec_news_comments_stats).click(function () {
$(div id='sec_news_comments'textarea name='comments' rows='7'
cols='70'/textareadiv id='add_comments'Save Comments/div/
div).insertBefore($(this).parent()).hide();
$(div#sec_news_comments).slideDown(slow);
}
- Problem () ---
$(div#add_comments).click(function(){
alert(Hello add_comments);// Some functionality but it did
not
even gave alert.
});