where an answer is written. and as i again click(single click) on the same link it answer get disappear. so why it doesn't show answer on single click of the link. I need to click twice on the link then it appear the following
.head { font-size:16px; font-weight:bold; text-decoration:underline; } .quest { padding-left:15px; cursor:pointer; } .answer { padding-left:12px; display:none; }
<fieldset> <ul id="odUL"> <li id="Order"><span class="head">Order:</span> <ul><br /> <li class="quest" onclick="showAnswer('od1')"> <u><span style="cursor:hand;">What does an order mean?</span></u> <p id="od1" class="answer"> <b>Ans.</b> An order is a quantity of goods or items purchased. </p> </li> <li class="quest"> <a href="javascript:showAnswer('od2')"> How can i check my current order status? </a> <p id="od2" class="answer"> <b>Ans.</b> You can check current order statur in MyOrders section. </p> </li>
function showAnswer(element) { if(document.getElementById(element).style.display=="none") { document.getElementById(element).style.display="block"; } else { document.getElementById(element).style.display="none"; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)