Using Javascript and CSS to display or hide HTML elementWednesday, October 31, 2018 / mcchu28Possibly save 1 hour of your time: Often you may need to display or hide a certain element based on some condition. function displayHtmlElement() { if (condition !== "") { $(element1).css('display', 'none'); $(element2).css('display', 'block'); } else { $(element1).css('display', 'block'); $(element2).css('display', 'none'); } } |
|