I have no idea how to search for this so I'm asking here.
I've inherited a project and no one that's here knows what this syntax trick is called.
There's a select drop down change event that will call a function if one or another specific value is selected from among the list.
$('#accordion select[name=x_range]').change(function(){
$('#custom-time')[$(this).val() == 'custom' ? 'show' : 'hide']();
$('#custom-time-to-now')[$(this).val() == 'custom_to_now' ? 'show' : 'hide']();
updateTimeIntervalOptions();
}).triggerHandler('change');
In this the show or hide function is called on the #custom-time or #custom-time-to-now divs.
What is calling functions like this called?
EDIT:
I should have said that I understand ternary if/else, but not the $(selector)[function_name]() part.
show/hideusing this obfuscated approach. If they knew of toggle, it could clearly be written as$(selector).toggle(condition).