Created
May 10, 2011 14:17
-
-
Save mfields/964552 to your computer and use it in GitHub Desktop.
Hide submit button if it exists.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Hide submit button if it exists. */ | |
var button = document.getElementById( 'my_submit_button' ); | |
if ( null !== button && 'style' in button && 'display' in button.style ) { | |
button.style.display = 'none'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
===
and==
operators behave exactly the same after doing type conversions. In the end,===
is faster if the two sides are different types (because it skips type conversion and just returns false) but==
is faster if the two types are the same.In your case, particularly when using Yoda conditions, there's no benefit of using one or the other since you're comparing with null. It becomes a matter of preference.