Slide down div
Slide down div
I'm using jquery with ruby on rails.
I'm trying to accomplish this: when the user click in one div, another div slidedown showing itself, because it was hidden.
There are several hidden div's that I want to do that, so the id of each one of them is like this: categoria_3, categoria_4, categoria_5, etc...
- the first div (this one is always visible); onclick calls the method "clickTitulo(id)"
- <div class="titulo" onclick="clickTitulo(3)">
- the second div (this one is hidden):
- <div style="display:none;" id="categoria_3">
The javascript:
- function clickTitulo(cat){
var id = "#categoria_"+cat;
$(document).ready(function(){
$(id).click(function(){
if ($(id).is(':hidden')){
$(id).slideDown('slow');
}
else{
$(id).slideUp('slow');
}
});
});
}
Well, it is not working.... I'm noob at jquery....Any help?