Here’s my fiddle: http://jsfiddle.net/mikeritter/prsfM/28/
Here’s my jQuery:
$(document).ready(function(){
function howdy(n){
alert('Howdy '+n+'!');
}
function hideArts(){
$('article').hide();
}
hideArts();
$("a.toggleart").click(function(){
var cur = $(this).parent().index();
//alert(cur);
$('article').eq(cur).toggle();
});
});
Why does the article immediately disappear after toggling?
You have an
<a>which sends the user to a new page. You should cancel the<a>event by adding ahref="#"oronclick="return false;"Sending the user to
href=""will reload the page if you don’t cancel it.