How to Show a Div in JavaScript or JQuery [Resolved]

Posted by Vuyiswamb under jQuery on 6/18/2012 | Points: 10 | Views : 1058 | Status : [Member] [MVP] [Administrator] | Replies : 2
Good Evening All

I have a small issue here. I have a Div inside a TD that is defined like this

 <td    >
<div id="divGoogleEarthMap" runat="server" style="display:none"
>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:ImageButton ID="GoogleEarthMap" runat="server" Height="100px"
OnClientClick="javascript:showimage('GoogleEarthMap'); return false;"
Width="100px" />
</div>
</td>


now the display style of this div is hidden. so i have a Javascript that runs when i close my popup. the first thing that javascript does is to populate two textboxes and show this div. It populate the textboxes nicely , but it fails to show or unhide the div. i have tried to set of code example using the normal javascript and also JQuery as depicted below



$('#divGoogleEarthMap').css('display', "block;");


and


 var div = document.getElementById("divGoogleEarthMap");
div.style.display = "block";


or


         document.getElementById('divGoogleEarthMap').style.display = 'block';


but still my Element cant be displayed.

Please note that i have a Sample Project that i can be supplied on request

Thanks

Thank you for posting at Dotnetfunda
[Administrator]



Responses

Posted by: Ajay.Kalol on: 6/18/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
Try with

var div = document.getElementById('<%= divGoogleEarthMap.clientID %>);
div.style.display = "block";

when you want to display your div.

Ajay
ajaypatelfromsanthal.blogspot.in

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 6/19/2012 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Thank that did the trick

Thank you for posting at Dotnetfunda
[Administrator]

Vuyiswamb, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response