I have the following code inside a javascript function that is inside a .php page:
if (indice_da_aba == -1)
{
window.alert('não existe ABAS AINDA');
}
else
if (indice_da_aba == 0)
{
$('a[href="#tab_00"]').tab('show');
}
else
if (indice_da_aba == 1)
{
$('a[href="#tab_01"]').tab('show');
}
else
if (indice_da_aba == 2)
{
$('a[href="#tab_02"]').tab('show');
}
As you can see, there are many if
s.
I wonder if it is possible to write a if
as follows:
if (indice_da_aba == -1)
{
window.alert('não existe ABAS AINDA');
}
else
{
$('a[href="#tab_0+indice_da_aba+"]').tab('show');
}
The way I wrote does not work. Is there a way to write (concatenate) this line or is it not possible?