我正在动态附加 html,但无法在图像下方添加按钮(当我启动 div 或 table 时,结束标签会自动关闭)
js函数的相关部分:
var fullimage='<li class="picture'+i+'"> <img id='+filename+' height="100" width="100" src='+this.result + ' /> </li> ';
var fullimage=fullimage+'<input type="button" id='+filename+' name="button2" value="Set as default"> </input>';
$('.pictures').append(fullimage);
HTML
<h3>Primary picture</h3>
<div id="primary-pic">
<p>jpg, png or bmp files <br /> <span>(max 2mb)</span></p>
<div class="custom-input-file">
`
<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
<!-- <input type="file" name="files[]" class="input-file" multiple="multiple" min="1" max"5"/> !-->
<input type="file" name="files[]" multiple onchange="readURL(this);" size="1" class="input-file" />
Choose files
<body>
</form>
</div>
</div>
<div id="more-pics">
<ul class="pictures">
<li class="picture1"> </li>
<li class="picture2"> </li>
<li class="picture3"> </li>
<li class="picture4"> </li>
</ul>
</div><!--/#more-pics-->`
可以在此处找到附加 html 的完整 js 函数: