I am using jquery inside the javascript function to hide & show div. I need to show only div "Area" while hide other div
This one works, when i directly put the name of the div to hide & show :---
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
function area_visible()
{
$('.Area').show();
$('.Area-1').hide();
$('.Area-2').hide();
$('.Area-3').hide();
}
This one does not works if i try to access using array of div class, even alert message is not displayed 4 times for loop :----
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
var area_id = [
"Area" , "Area-1", "Area-2", "Area-3"
];
function area_visible()
{
$(area_id).each(function(index, element) {
if(element != area_id[0] )
{
$("#" + element).hide();
}
alert('11');
});
}
Please suggest. How to hide and show div by taking there name from an array (and i want to use jquery inside javascript function) ?