jQuery(window).on('load', function () { if (jQuery(window).width() <= 999) { console.log( "the search block is placed with js" ); jQuery('#block-olivesdocs-solrsearchcontentadvancedsearchforpage').prependTo('#content'); } });