bratsun
6/26/2014 - 8:36 PM

Convert string to plain text id

Convert string to plain text id

$('.field h2, .field h3').each(function() {
  var t = $(this);
  var id = t.text().replace(/[^\w\s]/gi, '').replace(/\s+/g, '').toLowerCase();
  t.attr('id',id);
});