Hello friends, im a noob with a problem mabe a hero can help.
i have tried something and now i found a problem which i cant solve.
in the code are a var number of buttons which should show different divs (which was hide at the beginning) depend on the class.
The problem is the first while is working but the second one not. It execute just the last loop.
Why? and how can i solve this?
This is my code:
- <script type="application/javascript">
- $(document).ready(function (){
var i = 0;
while (i < 10){
$("." + i + ", .last").hide();
i++;
}
var ii = 0;
while (ii < 6){
$(".button" + ii).hover(function (){
$("." + ii).show();
}, function() {
$("." + ii).hide();
});
ii++;
}
});
</script>
- // just for exaple, the there is no fixed number of buttons it could be 3, 46, 77 or anyting else
- <p class="button0">button0<p> //button to show class 0
- <p class="0">0<p> //should vanish and appear
thanks 4 help heros!