Multiple “if”( if==1, if==2, if>2, etc.) variables with image display
-
Hello, lovely plugin. Simple and powerful.
There is a problem, it is necessary that data is displayed in the final field, according to the rules: if==1, if==2, if>2, etc., then a certain image is displayed.
If we have one variable, then using(function(){
var result = field name 7, url;
if(result < 10) url = ‘http://led-calc.ru/wp-content/uploads/2022/02/1773076164.png’;
else url = ‘https://catchsuccess.ru/wp-content/uploads/a/d/a/ada5184a4f07a5130630bbba74d81acf.jpeg’;
jQuery(‘.image-container’).html(‘‘);
return result;
})()we have the correct image displayed.
But for my situation, several if variables are needed. I tried to do the following:
(function(){
var result = fieldname18, url;
if(result == 2) url = ‘http://led-calc.ru/wp-content/uploads/2022/02/2-диода .gif’;
else if (result == 1) url = http://led-calc.ru/wp-content/uploads/2022/02/2022-02-18_20-25-59.jpg’;
else if (result > 2) url = http://led-calc.ru/wp-content/uploads/2022/02/2022-02-18_20-25-59.jpg’;
jQuery(‘.image-container’).html(‘‘);
return result;
})()But the result is not. I ask for help, what are we doing wrong.
- The topic ‘Multiple “if”( if==1, if==2, if>2, etc.) variables with image display’ is closed to new replies.