We will display a form with a listbox inside it. Once the form is submitted or input button is clicked we will be execute a function data_check() . Inside this function we will check the length of the selected option like this. First we will store the selected value in string variable.
The length of the string variable is str.length . Now using this we can submit the form or display the alert message.
Here is the code.
ListBox Validation : Checking if option is selected before submitting a form
ListBox Disable: using disabled property we can disable a listbox by radio button
Adding option: Adding options to a listbox dynamically
Moving Options Moving Options from a listbox to other
Removing Options: Removing options from a listbox
Copying List data : Copying user entered data from one to other form
Dependant list box : Linking two dropdown listboxes
list box with Data : Populating Listbox by taking data from MySQL table
Listbox Menu: Redirecting page based on selection of listbox