String +
if user click the + sign i want to show some oder list
then String -
If the user click the - sign i want to hide order list
How to acheive this with javascript , not using ajax , jquery
String +
if user click the + sign i want to show some oder list
then String -
If the user click the - sign i want to hide order list
How to acheive this with javascript , not using ajax , jquery
Hi
try this and attached it to your any event, i.e. onclick, onmouseover, etc...:
function toggleList(elem){
var theList = document.getElementById(elem);
if(theList.style.display == "none"){
theList.style.display == "block";
}
else{
theList.style.display == "none";
}
}
This method can be used for anything you want to show/hide. Obviously, you can call the function and variable anything you like that makes sense...
You will have to create an id for the ordered list, e.g.
<ol id="superId">
</ol>
then on javascript
function displayOL(enabled) {
if (enabled) {
document.getElementById("superId").style.display = "none";
document.getElementById("minus").style.display = "block";
document.getElementById("plus").style.display = "none";
} else {
document.getElementById("superId").style.display = "block"
document.getElementById("minus").style.display = "none";
document.getElementById("plus").style.display = "show";
}
}
then on anchor
tag
<a href="#" onclick="displayOL(true)" id="plus">+</a>
<a href="#" onclick="displayOL(false)" id="minus">-</a>
PS....I just did a rough implementation in no order....