4
Well I would like to be registering the days of the week selected directly in Sert, however I would like to be passing these values as a "phrase" to the hidden field. What is the way to be doing this in jquery? EX: I checked the Tuesday and Friday checkbox then the Hidden input would be sent = Tuesday, Friday
<input type="checkbox" name="dias[]" value="Segunda">Segunda
<input type="checkbox" name="dias[]" value="Terca">Terça
<input type="checkbox" name="dias[]" value="Quarta">Quarta
<input type="checkbox" name="dias[]" value="Quinta">Quinta
<input type="checkbox" name="dias[]" value="Sexta">Sexta
<input type="checkbox" name="dias[]" value="Sabado">Sabado
<input type="checkbox" name="dias[]" value="Domingo">Domingo
<input type="hidden" name="dias" value="">
really boy got very practical I have this code working in php, however I believe this method will relieve more php because using foreach for each check is 1 update more. a suggestion in jsfiddle puts the Hidden field as text for staff to see how it works :)
– Arsom Nolasco
Sergio, when you need to traverse an array to mount a second, it is preferable to use the map method.
– Tobias Mesquita
@Tobymosque there are those who say that jQuery’s map even uses more memory than each. If it were
.map()
native against.each()
jQuery agreed with you as well. Semantically it makes more sense toeach()
, and maybe option 2 was.filter()
.– Sergio
@Sergio, I tried to make a Benchmark, I was surprised by the result of jQuery.
– Tobias Mesquita