Random selection in jQuery
Posted
by danit
on Stack Overflow
See other posts from Stack Overflow
or by danit
Published on 2010-06-11T10:16:10Z
Indexed on
2010/06/11
10:22 UTC
Read the original article
Hit count: 192
jQuery
Im using the following function to hide a series of forms on a page:
$('.ask').toggle(function() {
$(this).text('-').next('.addtitle').slideDown('fast');
}, function() {
$(this).text('+').next('.addtitle').slideUp('fast');
});
There can be anything from 0 to 5 forms on the page all with the class .ask
What I want to be able to do is to select one form NOT to hide, so the jQuery needs to hide all put one of the forms on the page randomly.
How can I achieve this?
© Stack Overflow or respective owner