1
I have the following image below
and each checkbox corresponds to the value
<input type="checkbox" value="3" class="serie2" id="serie2[3]" name="serie2[3]">
<input type="checkbox" value="4" class="serie2" id="serie2[4]" name="serie2[4]">
<input type="checkbox" value="5" class="serie2" id="serie2[5]" name="serie2[5]">
successively ... coming from php :
echo "<label><i><input type='checkbox' name='serie2[$lnSer[ser_cod]]' id='serie2[$lnSer[ser_cod]]' class='serie2' value='$lnSer[ser_cod]' $marca>$lnSer[ser_descr]</i></label>";
following, if in my Ajax function I set the variable like this : var serie = '5,17,14'; ok, more when I try to go through using the function below, the problem occurs:
var serie = [];
$(".serie2:checked").each(function() {
serie.push(this.value);
});
how do I get the value in var serie = '5,17,14' ?
if I define the value as var stroke = 'I|25|TU-II|2|TU'; passes !
how do I get the value of this field, staying in this stroke format = 'I|25|TU-II|2|TU'
<option value="3|1|2">CICLOS E PRÁTICAS DOCENTES | Turma 2 | </option>
<option value="3|1|5">CICLOS E PRÁTICAS DOCENTES | Turma 5 | </option>
Thank you
At the end Voce wants the id of the selected checkboxes all in the same string separated by comma, and in the case of select are the ids separated by
|
, eh that?– Juliano Alves
have you tried using the "Join" function? It converts an array into a string, separating the elements by the argument sent to the function. variable.Join(", ");
– DeRamon