user1509
user1509

Reputation: 1161

Div doesn't fade out in update panel

I am using an Update Panel and inside it I have a div in which I show a message when the repeater's Item Command is fired. The div is visible false in beginning.

 <div id="divCommentsMsg" class="form_popup_Msg" visible="false" runat="server">
        <asp:Label ID="lblCommentsMsg" runat="server"></asp:Label>
  </div>

It is made visible on repeater's ItemCommand. To fade it out I use:

 $("#ctl00_ContentPlaceHolder1_ctrlComments_divCommentsMsg").delay(3000).fadeOut(100);

The div becomes visible but doesn't fade out. What should I do ?

UPDATE I am trying it in IE 9

Upvotes: 1

Views: 1014

Answers (3)

user1509
user1509

Reputation: 1161

I found a perfect solution to my problem at this link:

jQuery $(document).ready and UpdatePanels?

It was because Update Panel rebinds the jquery objects after every update.

Upvotes: 0

Anujith
Anujith

Reputation: 9370

Get the ClientID for the server Controls

$("#'<%=divCommentsMsg.ClientID %>'").delay(3000).fadeOut(100);

Upvotes: 2

gdoron
gdoron

Reputation: 150293

Try this:

$("#'<%=divCommentsMsg.ClientID %>'").delay(3000).fadeOut(100);

Use ClientID to get the "real" id of the element on the client side.

Alternatively use the Ends with selector:

$("[id$='divCommentsMsg']").delay(3000).fadeOut(100);

Upvotes: 4

Related Questions