-1
I need to put inside each element of my array, simple quotes.
In the code below, I check which checkbox is selected, and insert in my array.
var checkbox = $('input:checkbox[name^=checkregiao]:checked');
//verifica se existem checkbox selecionados
if(checkbox.length > 0){
//array para armazenar os valores
var regioes_selecionadas = [];
//função each para pegar os selecionados
checkbox.each(function(){
regioes_selecionadas.push($(this).val());
});
alert(regioes_selecionadas);
}
My Alert displays: "SP,MG,RS,BA" in this way.
I need it to look like this: "'SP','MG','RS','BA'". Look each element is separated by simple quotes..
I was able to use the command: var regioes_selected = JSON.stringify(regioes_selected);
It’s got double quotes. "SP","MG","RS","BA"
I need simple quotes "'SP','MG','RS','BA'" I need simple quotes. Before posting here, I search, I try to find a solution.
Thank you so much for your great help.
– PauloGalego