Is this the simplest way to write this? This code evaluates if a textbox value exceeds 20 characters, and then displays the proper message (essentially truncating the string and then adding an ellipses to the end.)
I've tried using a tertiary operator but doesn't seem to work with appending data to an element as it overwrites what was previously appended.)
if (searchBoxValue.length > numCharToDisplay) {
searchDropDown.append('<div class="noresults"><span>Searching "' +
searchBoxValue.trim().substring(0, numCharToDisplay) +
'..." Found No Results</span></div>');
} else {
searchDropDown.append('<div class="noresults"><span>Searching "' +
searchBoxValue.trim() + '" Found No Results</span></div>');
}