(function( $ ) { $( document ).ready( function() { $( '.typed-me' ).each( function() { var options = {}, strings = []; for( var key in this.dataset ) { if( key.substr( 0, 6 ) == "string" ) { var v = this.dataset[ key ].replace( /"/g, '"' ); // Replace & with & otherwise the browser freezes. v = v.replace(/"/g, '"'); v = v.replace('&', '&'); // in case the user already used & v = v.replace('&', '&'); strings.push( v ); } else { options[ key ] = parseInt( this.dataset[ key ] ); } } options[ 'strings' ] = strings; options[ 'contentType' ] = 'html'; $( this ).typed( options ); }); }); })(jQuery);