Im trying to use .show() to display div elements like slides in a slide show.
What I would like to do is use the ID property of a button on my nav bar to cause that slide to “slide in” much like a slide show. So button one has an id of “1”. I then use Jquery to append “#slide” to that id and get “#slide1”. which corresponds to a specific slide that I wish to show. So far I have been unable to get the “slide” div to appear with $variable.show().
Am I going about this wrong?
This is what I have so far.
http://jsfiddle.net/greyoxide/RN2jC/
$(".button").click(function () {
$(".slide").hide();
var content = $(this).attr('id');
var fix = "'" + '#slide' + content + "'";
$("#show").val(fix);
$(fix).show();
});
Get rid of the single quotes
', so change:To:
End result:
http://jsfiddle.net/RN2jC/9/