I have a form which has a bunch of checkboxes like this:
<input type="checkbox" name="input1" value="A, and B"/>A, and B
<input type="checkbox" name="input1" value="C"/>C
I also have some JQuery code that populates the already selected fields using JSTL like this:
$('input[name="input1"]').val("${form_inputs}".split(','));
The thing is since the value "A, and B" contains a comma, the jquery is splitting and setting the checkbox checked states wrong.
I already tried adding more commas so I could split at ",," but it doesnt seem to want to work.
Is there any way to change the comma splitter character to a different character?
Aucun commentaire:
Enregistrer un commentaire