Gives all inputs a class name of their type


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



Copy this code and paste it in your HTML
  1. $('input').each(function() {
  2. var inputType = $(this).attr('type');
  3. $(this).addClass(inputType);
  4. });

Report this snippet


Comments


You need to login to view comments.