validar limite de elementos seleccionados en select multiple


/ Published in: jQuery
Save to your folder(s)

validar limite de elementos seleccionados en select multiple


Copy this code and paste it in your HTML
  1. $('#selectRoles').change(function(event) {
  2. if ($(this).val().length > 5) {
  3. alert("Solo puede seleccionar 5 roles a la vez");
  4. $(this).val(ultimo_valido);
  5. }else{
  6. ultimo_valido = $(this).val();
  7. }
  8. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.