Home > Web Front-end > JS Tutorial > How to get the 16-bit code of font color with jQuery_jquery

How to get the 16-bit code of font color with jQuery_jquery

WBOY
Release: 2016-05-16 15:14:46
Original
1659 people have browsed it

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('');

Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template