Sha256: e6a94fd2001379f967feb7a3593a31a9fd005a811996f8e6fcdf00a0585c96fd
Contents?: true
Size: 829 Bytes
Versions: 7
Compression:
Stored size: 829 Bytes
Contents
// Underline text in elements. Especially useful for accesskeys. // Written by Daniel Mendler (function($) { $.extend($.fn, { // Underline text underlineText: function(str) { this.each(function() { var elem = $(this), text, i; if (elem.children().size() === 0) { text = elem.text(); i = text.toLowerCase().indexOf(str.toLowerCase()); if (i >= 0) { elem.html(text.substr(0, i) + '<span style="text-decoration: underline">' + text.substr(i, str.length) + '</span>' + text.substr(i+str.length)); } } else { elem.children().underlineText(str); } }); }, // Underline access key underlineAccessKey: function() { this.each(function() { var key = $(this).attr('accesskey'); if (key) { $(this).underlineText(key); } }); } }); })(jQuery);
Version data entries
7 entries across 7 versions & 1 rubygems