I am working on multiselect group. Here is the link i have populated some data in the multiselect group and the users can select their requirements in that. http://vignesh.gvignesh.org/chose/chose.php
Here once show selected button is clicked i am calling javascript function.
function chos()
{
var a = $(".chzn-select").chosen();
alert(a);
}
it is not showing the selected values in alert box. Some [object][object] is displayed. i dont know how to get the selected values. If my javascript function for getting the values is wrong kindly let me know the new function.
Thanks in Advance.
Just use $("#chossen").val()
, which returns an array of value
s that are currently selected.
To get the actual option
elements that are selected, try $("#chossen").find("option:selected");
, and then loop through those (obviously) - in case you want to get their text
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.