I have a multi-segment list and before submitting the form I want to check if the user selects a parameter or not via jquery
You can use the function .val()to get the selected values. For multi select, it returns an array of selected values or null if no items were selected:
.val()
if ($('#idofselect').val() != null) { // user has selected at least one value }
This works for you:
$("#formID").submit(function() { var selectValue = $('#selectList').val(); if(selectValue != null) { // blah } });
$('#list option:selected').length
I will get the number of selected objects. (obviously replace "#list" with your selector).
Source: https://habr.com/ru/post/1751193/More articles:C4564 warning when creating a C ++ / CLI project that consumes a strongly typed dataset - visual-c ++Print ER charts for mySQL database (800+ tables) - sqlHow to make ZipArchive not overwrite specific files and folders - phpMakefile to compile .cpp and .h series in lib - c ++Устойчивость ранних выпусков продукта - project-managementchrome / safari (webkit?) doesn't post values when submitted via Javascript.submit () - javascriptHow to allow StringTemplate.NET to load template files with the extension ".dwt"? - .netWhich collection supports multiple simultaneous inserts? - javahow to send array values via url in php? - urlhow to get ram speed? - c #All Articles