Oatmeal
Oatmeal

Reputation: 759

Displaying "alert" messages in Twitter Bootstrap rails Carousel

I am using Twitter Bootstrap rails Carousel for a survey project. I need to add a feature where if user doesnot answer a question and try to click next arrow should be shown a message "please choose an answer before proceeding".. how do I accomplish this? is it by alert message? how do I do this?

Upvotes: 0

Views: 227

Answers (1)

yxf
yxf

Reputation: 493

$(".carousel-next").on("click",function(){
if(condition){ // condition -> doesnot answer a question
    alert('message'); 
    return false;
}

});

  $(".carousel-prev").on("click",function(){
    if($(".carousel-inner .item.active").index() == 0){
        return false;
    }
  });

Upvotes: 1

Related Questions