JSFiddle - React, Tailwind, and code Playground
by Marventus
HTML
<p id="par1" class="target">Paragraph 1</p>
<p id="par2" class="target">Paragraph 2</p>
<p id="par3" class="target">Paragraph 3</p>
<br/><br/>
<p><strong>Paragraph IDs (regular): </strong><span id="regular"></span></p>
<p><strong>Paragraph IDs (JSON): </strong><span id="json"></span></p>
<br/>
<p><input id="trigger" type="button" value="Click me" /></p>
CSS
strong{
font-weight:bold;
}
JavaScript
/**************************************************************************
START jQuery JSON Plugin
Author: Brantley Harris
Url: http://code.google.com/p/jquery-json/
MIT License: http://www.opensource.org/licenses/mit-license.php
***************************************************************************/
(function( $ ) {
var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
};
$.toJSON = typeof JSON === 'object' && JSON.stringify
? JSON.stringify
: function( o ) {
if ( o === null ) {
return 'null';
}
var type = typeof o;
if ( type === 'undefined' ) {
return undefined;
}
if ( type === 'number' || type === 'boolean' ) {
return '' + o;
}
if ( type === 'string') {
return $.quoteString( o );
}
if ( type === 'object' ) {
if ( typeof o.toJSON === 'function' ) {
return $.toJSON( o.toJSON() );
}
if ( o.constructor === Date ) {
var month = o.getUTCMonth() + 1,
day = o.getUTCDate(),
year = o.getUTCFullYear(),
hours = o.getUTCHours(),
minutes = o.getUTCMinutes(),
seconds = o.getUTCSeconds(),
milli = o.getUTCMilliseconds();
if ( month < 10 ) {
month = '0' + month;
}
if ( day < 10 ) {
day = '0' + day;
}
if ( hours < 10 ) {
hours = '0' + hours;
}
if ( minutes < 10 ) {
minutes = '0' + minutes;
}
if ( seconds < 10 ) {
...