Connecting Tech Pros Worldwide Help | Site Map

onClick() function not working when page is refreshed through AJAX

Newbie
 
Join Date: May 2007
Posts: 3
#1: May 29 '07
hi,

I am facing one problem which is related to AJAX. I have a html page which has some links. When the page is refreshed using AJAX then if some new new link is added to the page on this refresh, then the onClick function of this particular link is not working. Plz help
Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: May 29 '07

re: onClick() function not working when page is refreshed through AJAX


Quote:

Originally Posted by msinghal

hi,

I am facing one problem which is related to AJAX. I have a html page which has some links. When the page is refreshed using AJAX then if some new new link is added to the page on this refresh, then the onClick function of this particular link is not working. Plz help

What is hapening on the refresh? You might have to show some code.
Newbie
 
Join Date: May 2007
Posts: 3
#3: May 29 '07

re: onClick() function not working when page is refreshed through AJAX


Quote:

Originally Posted by r035198x

What is hapening on the refresh? You might have to show some code.

I am trying to call a javascript function onClick of a calendar icon (which was rendered by AJAX) and I am getting JS error that the function is undefined (which I am trying to call on onClick)

Here is a code snipplet (which is rendered using AJAX)

markupWriter.begin("a");
markupWriter.attribute("name", this.getName() + "CalendarAnchor");
markupWriter.attribute("href", "javascript:void(0);");
markupWriter.attribute("class", "nonnav");
markupWriter.attribute("onclick", "showCalendar();");
markupWriter.closeTag();

showCalendar() function is defined in the same file.
Newbie
 
Join Date: May 2007
Posts: 3
#4: May 29 '07

re: onClick() function not working when page is refreshed through AJAX


Quote:

Originally Posted by r035198x

What is hapening on the refresh? You might have to show some code.

I have send u a code snipplet. Plz see if u can help me with it.....I am waiting for ur response.
Reply