Unable to .append(); without eliminating all the spaces in the code
Posted
by
Adam
on Stack Overflow
See other posts from Stack Overflow
or by Adam
Published on 2010-12-30T04:42:13Z
Indexed on
2010/12/30
4:53 UTC
Read the original article
Hit count: 156
$('#form_holder').append('<div id="spec_id_'+count+'"><div class="avail_container">
<input class="avail_fields" type="checkbox" checked="checked" name="special'+count+'" /><span class="avail_field_label">Special Date</span></div>
<div class="avail_container"><div class="avail_time_container"><span class="field_label">Time</span>
<select name="special'+count+'_time_from_1">
<?php
for ($t = 0; $t<24; $t++){
?>
<option value="<?php echo $t; ?>"><?php echo $t; ?></option>
<?php
}
?>
</select>:
<select name="special'+count+'_time_from_2">
<?php
for ($t = 0; $t<60; $t+=15){
?>
<option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option>
<?php
}
?>
</select>
<span class="field_label">to</span>
<select name="special'+count+'_time_to_1">
<?php
for ($t = 0; $t<24; $t++){
?>
<option value="<?php echo $t; ?>"><?php echo $t; ?></option>
<?php
}
?>
</select>:
<select name="special'+count+'_time_to_2">
<?php
for ($t = 0; $t<60; $t+=15){
?>
<option value="<?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?>"><?php if($t == 0){ echo $t . '' . $t; }else{ echo $t; } ?></option>
<?php
}
?>
</select>
</div>
</div>
</div>');
I'm assuming javascript or jquery does not like breaks like I have here, because all my javascript code does not work.
What would be an alternative to eliminating all the spaces, which would make viewing the code difficult?
© Stack Overflow or respective owner