Check out my latest project: JSBin - live JavaScript pastebin

to hex

d.toString(16)

Beautifully simple way to get a hex value from a number. Note that d is a number. If you want a string as a hex XML valid code, use:

'&#x' + parseInt(number).toString(16).toUpperCase() + ';'

Leave a Reply
Not required

CODE: Please escape code and wrap in <pre><code>, doing so will automatically syntax highlight