Click here to Skip to main content
13,734,201 members
Rate this:
Please Sign up or sign in to vote.
See more:

I have a javascript function to show/hide a [runat="server"] div
it works in all browsers but Safari

javascript function:
<script type="text/javascript">

	    function Show_Hide_Display() {
	        var div1 = document.getElementById('<%=main_filter.ClientID%>');

		    if ( == "" || == "block") {
 = "none";
		    else {
 = "block";
		    return false;


calling the javascript function:
<pre><div class="col-md-6 col-xs-3 pull-right btn-mobile">
	<input type="button" class="btn btn-primary btn-block span3" id="closefilter" value="Done" onclick="Show_Hide_Display()" />

please advise

What I have tried:

I tried to use JQuery but still the same:
$(document).ready(function () {
           $("#closefilter").click(function () {

removed the (IF) statement from the JavaScript function but still the same.
but the same as well!!
Posted 8-Nov-17 8:50am
A_Griffin 8-Nov-17 18:52pm
A couple of possibilities here:

1. This worked for me with a similar problem, where Safari didn't set the display to block: My fix was to do
document.getElementById('editRow').style.display = ''; followed by
document.getElementById('editRow').style.display = 'block'; - tested on IE11, Chrome, Safari

2. won't displa properly here, but read the stackoverflow page - ans about replacing the page declarations

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 8 Nov 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100