Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I hide a part of javascript from IE

This is my javascript function to open a jquery dialog.

   ('#dialog').append(iframe).appendTo("body").dialog({
          autoOpen: false,
          modal: true,
          resizable: false,
          show: 'slide',        
          width: 800,       
          height: 700,        
         close: function() {           
    }   
});             
$('#dialog_click').click("callback",function() {            
   $('#dialog').dialog('open');                 
   return false;
}); 

How can I hide the part show: 'slide, from IE ?

like image 316
Mohamed Avatar asked Apr 18 '13 11:04

Mohamed


People also ask

How do I hide a section in JavaScript?

Style display property is used to hide and show the content of HTML DOM by accessing the DOM element using JavaScript/jQuery. To hide an element, set the style display property to “none”. document. getElementById("element").

What is hide () in JavaScript?

The hide() method hides the selected elements. Tip: This is similar to the CSS property display:none. Note: Hidden elements will not be displayed at all (no longer affects the layout of the page). Tip: To show hidden elements, look at the show() method.

How do you change JavaScript in Internet Explorer?

Internet ExplorerClick Tools > Internet Options. Click the Security tab > Custom Level. In the Scripting section, click Enable for Active Scripting. In the dialog box that displays, click Yes.

Can JavaScript hide HTML elements?

Using Css style we can hide or show HTML elements in javascript. Css provides properties such as block and none to hide/show the HTML elements.


4 Answers

var options = {
          autoOpen: false,
          modal: true,
          resizable: false,       
          width: 800,       
          height: 700,        
         close: function() {           
    }   
};
if ( ! $.browser.msie){
  options ['show'] = 'slide';
}

$('#dialog').append(iframe).appendTo("body").dialog(options);  
like image 58
Hilmi Avatar answered Oct 23 '22 08:10

Hilmi


try this

if ( ! $.browser.msie){
  $( "#dialog" ).dialog( "option", "show", "slide" )
} 
like image 23
PSR Avatar answered Oct 23 '22 06:10

PSR


jquery has removed support for jQuery.browser.msie from version >= 1.9

so

var opts = {
    autoOpen : false,
    modal : true,
    resizable : false,
    show : 'slide',
    width : 800,
    height : 700,
    close : function() {
    }
};
if (!/msie/.test(window.navigator.userAgent)) {
    opts.show = 'slide';
}

('#dialog').append(iframe).appendTo("body").dialog(opts);
$('#dialog_click').click("callback", function() {
    $('#dialog').dialog('open');
    return false;
});
like image 28
Arun P Johny Avatar answered Oct 23 '22 07:10

Arun P Johny


$('#dialog').append(iframe).appendTo("body").dialog({
          autoOpen: false,
          modal: true,
          resizable: false,       
          width: 800,       
          height: 700,        
         close: function() {           
    } 
});

if(!$.browser.msie) {
     $( "#dialog" ).dialog( "option", "show", "slide" );
}
like image 2
Chris Dixon Avatar answered Oct 23 '22 08:10

Chris Dixon