Restrict the max li selected in external JS file | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Restrict the max li selected in external JS file

I would like to restrict the li selected to be max 3 or max input to #moduleList is 3. How can I add it into the JavaScript below? $('#moduleDrop li').click(function(){ $(this).toggleClass('selected'); $('#moduleList').html($('#moduleDrop .selected').clone()); });

22nd Feb 2020, 5:31 PM
SWL
1 Answer
+ 1
Did your find a solution? Im just a js noob
6th Mar 2020, 11:00 PM
Jdubyou
Jdubyou - avatar