0

Submit button validation to 3 selected li only

How to check if the selected modules are 3 or less than 3. When less than 3 prompt alert please select 3 modules. If selected 3 modules, prompt thank you for submission. $('#selectModule').click(function(){ if ('#moduleList li:gt(2)' == 3) { alert("Thank you. Your selected modules have been submitted."); } else { alert("Please select 3 modules for submission"); } });

2/23/2020 5:32:48 AM

SWL

1 Answer

New Answer

+1

I wud have a loop before With an if statement and counter If selected moduleList++ Then check if that value is greater than 3