Of course the when this select is comes with less options it will be better to leave it like this, and when it comes more then this it better to make it via loop. The question is that if I should make it loop or leave it as it is ? which way is the best and why ?
var htmlTemplate =
"<select class='action cycle' auto='1' value='24'>" +
"<option value='6'>6 hours</option>" +
"<option value='12'>12 hours</option>" +
"<option value='24' selected=''>24 hours</option>" +
"<option value='48'>48 hours</option>" +
"<option value='72'>72 hours</option>" +
"</select>";
Also, in my current project I'm making 'Add' button which creates some html dom elements. My question is if I should leave the code inside string or create it via javascript (createElement) and again, I would like to know what is the best way and why :)
var htmlTemplate = "class='target-unit' identify='blahblah'";
htmlTemplate = "<div " + targetTemplate + ">" +
"<span class='target-place'>" + targetPlace + "</span>" +
"<select class='action campaign'>" + targetOptions + "</select>" +
"<label input-label='' class='target-limit'>5000</label>" +
"<select class='action cycle' auto='1' value='24'>" +
"<option value='6'>6 hours</option>" +
"<option value='12'>12 hours</option>" +
"<option value='24' selected=''>24 hours</option>" +
"<option value='48'>48 hours</option>" +
"<option value='72'>72 hours</option>" +
"</select>" +
"<button class='action small button-icon add flr no-title' identify='target-add'></button>" +
"</div>";