You can use a ternary if statement for that:
.append( "<span>" + (variable == 1 ? writeHere : "" ) + "</span>" );
Pregunta
Is it possible to do something like this
$( "#till__tablepanel_table_"+tablenumber ).append( "<span>"+if (variable == 1) { writeHere }+"</span>" );
I cannot seem to get this working. Example: How would i writeHere
if the conditions were true?
Solución
You can use a ternary if statement for that:
.append( "<span>" + (variable == 1 ? writeHere : "" ) + "</span>" );