Is there a more elegant way of writing this code ? I don't need IE support.
if (a == '')
{
$('.some-class').html('');
}
else
{
$('.some-class').html('Some Text');
}
I can only think of this :
$('.some-class').html(a == '' ? '' : 'Some Text');
The empty string "" is a falsy value, thus you can do :
$('.some-class').html(a || "Some text");