<body class="index"> <!--...--> </body>
var MESSAGE = 'Added after document be ready and because \'.index\' selector was found!'; var awaitAndAppendContent = function() { var $content = $( '<h2>' ).text( MESSAGE ); var appendContent = function() { $( 'body' ).append( $content ) } setTimeout( appendContent, 700 ); } $.behavior.to( '.index' ).ifPresent( awaitAndAppendContent );