I have this jQuery if-statement working. Is there a more simple/elegant or less repetitive way to write it?
“If foo is visible, add this HTML element to #message, else add this other HTML element to #message.”
$(document).ready(function() {
var $foo= $('#something');
if ($foo.is(':visible')) {
$('#message').html('<strong>Yes</strong>, message one.');
}
else {
$('#message').html('<strong>No</strong>, message two.');
}
});