I am new to jQuery, can someone please tell me if I formulated the above if statement correctly? I basically want something to start if my variable width is 900px. My variablevar $brewapp = $('#brewapp');
var $brewapp = $('#brewapp');
Thank.
if (($brewapp).width == '900px') { //what i want it to do }
.widthis a function that returns a number. Therefore, your test should look like this:
.width
if ($brewapp.width() === 900)
I suggest Mozilla Javascript docs if you want to deepen your knowledge of JS.
You need to add only two characters:
if ($brewapp.width() == 900) { //what i want it to do }
, :
- , use() , "px".
jQuery. jQuery width() , el.style.width( , ).