1

I have a placeholder and want to show it using JQuery. Now in placeholder I cannot have style="Visibility:hidden" so I have to set the Visible Property to False, hence Jquery not able to find it.

My question is how do I set the visibility on JQuery load function instead, have tried following with no success(bare in mind my controls have this extra characters at beginning so need by ClientID):

 $('div[id*=phAdd]').hide();
 $('div[id$=phAdd]').hide();
Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
Zaki
  • 5,540
  • 7
  • 54
  • 91
  • 1
    possible duplicate of http://stackoverflow.com/questions/17326031/jquery-show-not-working-on-asp-mvc-3-fieldsets – Mgetz Jun 26 '13 at 17:19

1 Answers1

1

The reason for this Placeholder not being found is because of this line

`Visible="false"`

while defining the ASP.NET control

Visible="false" does not render the element in the First place. So you have no way of selecting it. Instead remove that line and add a Class to it which has the display property set.

So by doing this the element will be available on the DOM and your selector should work fine.

<asp:Placeholder runat="server" ClassName="hide" 

CSS

.hide{
    display: none;
}
Sushanth --
  • 55,259
  • 9
  • 66
  • 105