change a attr of element when windows width less than value with jquery <p>I want when windows width less than 992, change css attr of one element. I wrote this code:</p> <pre><code>$(document).ready() { if ($(window).width() &lt; 992) { $('#header_right').css('text-align', 'center'); } } </code></pre> <p>If I execute</p> <pre><code>if ($(window).width() &lt; 992) { $('#header_right').css('text-align', 'center'); } </code></pre> <p>in console by ff done but when use this code in file such as up don't worked.</p> <p>I use this js file in head:</p> <pre><code>&lt;script src="js/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="js/bootstrap.min.js"&gt;&lt;/script&gt; &lt;script src="js/main.js"&gt;&lt;/script&gt; </code></pre> <p>Please advice.</p>