1

I am using dynamic binding in jquery for the events in my page. In my page i have '+' image which expands the underneath values (table rows). the '+' is an image, when this is clicked i have to show the rows and change the image as '-'. I used to check the image wheather the '+' or '-' clicked using the following code.

var nImgPlusPos = obj.indexOf("plus.gif");
if (nImgPlusPos > 1) 
{
    $("#" + sImgID).show();
    $("#" + sTrID).show();
    $("#imgExpand" + sUniqueID).attr("src", "/Images/minus.gif");
} else {
        $("#" + sImgID).hide();
}

These page is created as tab page using Ajax, so the event is bound during the Ajax call and the above code is working at first time and when the tab is relaunched the functionality-Expanding the rows below is not working.

Any kind of help is appreciated.

jsalonen
  • 29,593
  • 15
  • 91
  • 109
suna
  • 11
  • 1
  • Adding, when i check the indexPos of nImgPlusPos give the vlaues as -1, 17.. whenever the tab is changed. So i finding inconsistency in using indexOf() . – suna Jun 18 '12 at 11:26

1 Answers1

1

what are you using for your ajax call ?

if you are using .post try using this:

$('#div').live('click', function(e) {
}

http://api.jquery.com/live/

jsalonen
  • 29,593
  • 15
  • 91
  • 109
Sunjalo
  • 189
  • 1
  • 6