if else statement in jquery
I have found out I could not use an if statement in Jquery (unless done with plain js instead).
Do you think creating two if statements are the best practice to achieve this?
- $(document).ready(function() {
- $('#select_preferences').multiselect({
- buttonText: function(options, select) {
- return 'Look for users that:';
- },
- buttonTitle: function(options, select) {
- var labels = [];
- options.each(function() {
- labels.push($(this).text());
- });
- if(!labels.length ===0 )
- {
- $('#range-div').removeClass('hide');
- }
- if (labels.length ===0)
- $('#range-div').addClass('hide');
- return labels.join(' - ');
-
- }
- });