Article
If statement
https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
Copy to clipboard
The if statement checks if a condition is met before executing code. For example if we want to alert a user if his browser window size is less than or equal to 991, we use the variable window.innerWidth like this: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/conditionals/ex1.js?actionable=true Here, the window.innerWidth
<script>
$(document).ready(function(){
XT1
});
</script>
$(document).ready(function(){
XT1
});
</script>
Copy to clipboard
Live demo
<script>
$(document).ready(function() {
XT1
});
</script>
$(document).ready(function() {
XT1
});
</script>
Copy to clipboard
Press the Run Demo button to execute the scripts above.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.