Home >Web Front-end >JS Tutorial >How to get the 16-bit code of font color with jQuery_jquery
The example in this article describes how jQuery obtains the 16-bit code of font color. Share it with everyone for your reference, the details are as follows:
var i = $(this).css('color'); var o = i.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); delete (o[0]); for (var n = 1; n <= 3; ++n) { o[n] = parseInt(o[n]).toString(16); if (o[n].length == 1) o[n] = '0' + o[n]; } var s = o.join('');
Readers who are interested in more jQuery-related content can check out the special topics on this site: "JQuery drag effects and techniques summary", "jQuery common classic special effects summary", " jQuery extension skills summary", "jquery selector usage summary" and "jquery common operation skills summary"
I hope this article will be helpful to everyone in jQuery programming.