ajax-chosen
ajax-chosen copied to clipboard
changed existing selected_values check to use value instead of value/label
I don't see a reason to use the label instead of the value:
selected_values.push($(this).val() + "-" + $(this).text());
Why not just use:
selected_values.push($(this).val())
I was having trouble with returned JSON and encoded HTML entities not matching the label that was pulled from the page using .text()
- sure it is possible to also use .html()
but why not forget about the labels and check for duplicates / existing based on the selected value and not the label? the part of the code that was changed is not used when displaying the dropdown, etc.