Not working. $ ("# content"). css ("display", "flex"); in Firefox

0

I have the following code that shows some texts when I click on a button.

Works well in all browsers except in Firefox 53.0.3 64 bits , any ideas?

  $(document).ready(function(event) {
    $('#btn-servicios-1').click(mostrarServicios1);
    $('#cerrar-servicios-1').click(cerrarServicios1);
  });

  function cerrarServicios1() {
    event.preventDefault();
    $("#contenido-servicios-1").hide();
  }

  function mostrarServicios1() {
    event.preventDefault();
    $("#contenido-servicios-1").css("display", "flex");
  }

I just tried:

$("#contenido-servicios-1").show();
$("#contenido-servicios-1").css("display", "flex");

And it does not work either

I've tried only with

$("#contenido-servicios-1").show();

And it's not going either, it's not a matter of using show(); or .css(display) .

PS: SOLVED

function cerrarServicios1(event) {
    event.preventDefault(event);
    $("#contenido-servicios-1").hide();
  }

  function mostrarServicios1(event) {
    event.preventDefault(event);
    $("#contenido-servicios-1").css("display", "flex");
  }

In the end I solved it by adding 'event' in the functions. Thank you all for the inconvenience.

    
asked by Mark Lenders 08.06.2017 в 10:55
source

1 answer

1

I was just writing you a similar solution when I see that you have solved it. Here is the code that I tried:

 $(document).ready(function() {
   $('#btn-servicios-1').click(mostrarServicios1);
   $('#cerrar-servicios-1').click(cerrarServicios1);
 });

 function cerrarServicios1() {
   $("#contenido-servicios-1").hide();
   return false;
 }

function mostrarServicios1() {
  $("#contenido-servicios-1").css("display", "flex");
  return false;
}

return false also serves to stop the spread. I hope you find it useful:)

    
answered by 08.06.2017 в 13:20