regarding js

QuestionsCategory: Questionsregarding js
nina sheikh asked 7 days ago

sir actually there are 30 question…each question has categary id….if i  wish to see question no 20 then its shud display as a question Q.20 what is html? with options  i m suppose to use js array while loop  n for loop wats the logic sir i need code

1 Answers
therichpost answered 7 days ago

Here  is the test login

//Html
<a href=”Q1″ class=”ques”>Q1</a>
<a href=”Q2″  class=”ques”>Q1</a>
<div id=”Q1″ class=”quesDiv”>Q1</div>
<div id=”Q2″ class=”quesDiv” style=”display: none;”>Q2</div>
 
//jQuery
$(“.ques”).each(function() {
  $(this).click(function(event) {
    event.preventDefault();
    var href = $(this).attr(“href”);
    $(“.quesDiv”).hide();
    $(“#”+href).show();
  });
 
});

Your Answer

14 + 11 =