我在JavaScript中有一個問題,我需要有一個像這樣單引號
<input type="text" class="form-control" id="from_date" name="from_date" data-inputmask="'alias': 'dd/mm/yyyy'" data-mask>
的代碼和我的javascript代碼裏面是
strinner="<legend>Attachment "+numrows+" </legend><div class='row'> <div class='col-md-4'><div class='form-group'><input type='text' id='attachment_caption"+numrows+"' name='attachment_caption"+numrows+"' placeholder='Attachment caption' class='form-control'/></div> </div><div class='col-md-3'><div class='form-group'><input type='file' id='document"+numrows+"' name='document"+numrows+"' onclick='disableurl("+numrows+")' /></div></div><div class='col-md-1'><label for=''></label><br> <img src='https://cdn2.iconfinder.com/data/icons/basic-4/512/close-128.png' title='Click to remove File' id='clear_multiple"+numrows+"' height='18px' style='cursor:pointer' onclick='remove("+numrows+")'/></div><div class='col-md-4'><div class='form-group'><input type='text' id='url"+numrows+"' name='url"+numrows+"' placeholder='Attachment URL' onkeyup='disablefile("+numrows+")' class='form-control'/></div></div></div><div class='row'><div class='col-md-4'><div class='form-group'><label>From Date:</label><div class='input-group'><div class='input-group-addon'><i class='fa fa-calendar'></i></div>**<input type='text' class='form-control' id='from_date1' name='from_date1' data-inputmask='alias:dd/mm/yyyy' data-mask>**</div></div></div></div>";
的問題是在在strinner.I ID FROM_DATE領域需要
data-inputmask="'alias': 'dd/mm/yyyy'"
請幫助我
人們很難想象爲什麼不將複雜的HTML構建爲字符串的一個更好的例子。 –