what I am trying to do is append a <select> tag and do an if statement.
I do have error. I think it's the way I am concatenating the string..
here's my code:
var load_volumes = jQuery('.micronic').val();
var arr_volumes = load_volumes.split(',');
var count_volumes = arr_volumes.length;
for(x=0; x<count_volumes; x++){
jQuery('.append_here').append("<select class='volumes'>"
+"<option>Choose Volume</option>"
+"<option"
+ if(arr_volumes[x] == 0.5){
+ "selected"
+ }
+">0.5</option>"
+"<option>0.75</option>"
+"<option>1.10</option>"
+"<option>1.40</option>"
+"<option>2.0</option>"
+"<option>2.5</option>"
+"<option>3.0</option>"
+"<option>4.0</option>"
+"<option>6.0</option>"
+"<option>7.5</option></select>  ");
}
thanks in advance.
Uncaught SyntaxError: Unexpected token if@PraveenKumarifstatement in the middle of a string like that+ (arr_volumes[x] == 0.5 ? "selected" : "")