Javascript loop continue,or break to display?
This is my code use for show or hide some data in table
if (type=='SHOW') {
for(var i = 0; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = '';
}
else if (type=='SHOW_EXCEPT'){
document.getElementById(list_tr[0]).style.display = 'none';
document.getElementById(list_tr[1]).style.display = '';
for(var i = 2; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = 'none';
}
}else{
for(var i = 0; i<list_tr.length; i++) {
document.getElementById(list_tr[i]).style.display = 'none';
}
}
In else case:
I want to hidden all but show list_tr[2] iftype=='SHOW_EXCEPT'
How can I do in this case?
thanks
That should do the trick if I have understood the question correctly