jquery - show and hide multiple divs on click -


i have 3 links , each link points different version of document. how can show/hide them?

right now, have <div id="defaulttemplate">. default. below it, have <div id="option2" class="hidden"> , <div id="option3" class="hidden">

options 2 , 3 hidden should be, want show/hide each user clicks on links.

here non-working jquery:

$('.option1, .option2, .option3').click(function(){     var toshow = $(this).attr("class");     console.log(toshow);     $('#defaulttemplate').fadeout(600, function(){         $('#' + toshow).show();      }); }); 

thanks!

your id's have capital o in option2 id="option2"

as classes clicking have small o ,

when -

$('#' + toshow).show(); i.e $('#option2').show(); , no id option2 is id, option2

you need change id's option1,option2,option3 , small o


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -