JohnMichael JohnMichael - 5 months ago 5x
jQuery Question

Toggling the opacity of a div

I'm trying to write a code that toggles the opacity of a div but I'm running into trouble with it. If I click this button, I want it to set the opacity of #infodiv to 1.0, where it's set at 0.0 right now, like so.

width: 250px;
height: 0px;
margin-top: 10%;
opacity: 0.0;

This is the function that I'm trying to call.

function toggles(){

infodiv.css('opacity', '1.0');

It's probably the function that it's need of some tweaking, maybe? Thanks to anyone willing to take a look to help out. Here's a fiddle


You must set style of element with jQuery:

function toggles() {
  $('#infodiv').css('opacity', '1.0');