Satch3000
Satch3000

Reputation: 49404

JQuery Show Hidden Div command inside function

I have a JQuery function:

function MyFunction() {
     //I need a command here to show a hidden div
     ....
}


<div id="hiddenDiv" style="display:none"></div>

Basically, I need to Div above to show when the function is called.

Thanks

Upvotes: 0

Views: 1155

Answers (2)

Dutchie432
Dutchie432

Reputation: 29160

There are many options.

<div id='hiddenDiv' style='display:none;'></div>

then...

MyFunction('hiddenDiv');

function MyFunction(divId) {
     //$('#' + divId).show();
     $('#' + divId).fadeIn('fast');
     //$('#' + divId).slideDown('fast');
}

Upvotes: 0

Phil.Wheeler
Phil.Wheeler

Reputation: 16858

What's wrong with using $('#hiddenDiv').show()?

function MyFunction() {
     $('#hiddenDiv').show();
     ....
}

Upvotes: 2

Related Questions