Reputation: 3415
I'm trying to figure out a way to .slide on a during page load, but I am unsure of the best practice to do so. I am familiar with using the .slide method, but am unsure how I can fix it to execute on page load, rather than a click.
$(function() {
$("#clickLink").click(
function () {
$("#hiddenField").slideDown("slow");
}
)
});
Upvotes: 0
Views: 114
Reputation: 3065
inside the script tag write
$(document).ready(function (){
$("#hiddenField").slideDown("slow");
})
Note: to SlideDown any of your control on the webpage/html its css display property should be
display:none
But here from your ID use in the code you are trying to display hidden field. HTML hidden fields are not displayed even after display:block
thats the reason they are hidden fields.
Please verify the code and if possible so us your html and which element you are trying to display (slide down) on page load.
Upvotes: 2
Reputation: 319
$().ready(function(){
$("#hiddenField").slideDown("slow");
});
Upvotes: 0
Reputation: 29508
Anything within $(function() { ... here ... });
will be executed when the page is loaded.
$(function() {
$("#hiddenField").slideDown("slow");
});
Upvotes: 0