how to set limit for select tag in jQuery | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to set limit for select tag in jQuery

Max 10

29th May 2019, 1:14 PM
shu
shu - avatar
2 Answers
+ 3
shu Hi shu , You can do this by adding this lines of Jquery $("select").on('change', function(t) { if (Object.keys($(this).val()).length <10) { $('option[value="' + $(this).val().toString().split(',')[10] + '"]').prop('selected', false); } }); If you need any more help ping me Have this till that 🍎 🍎 🍎 🍎 🍎
29th May 2019, 1:43 PM
DishaAhuja
DishaAhuja - avatar
0
Thanks Disha
29th May 2019, 5:37 PM
shu
shu - avatar