IE8 버튼을 클릭하여 div에 요소를 추가하려고 할 때 두 번째 누를 때까지 추가하지 마십시오. 그런 다음 두 개의 새로운 요소를 추가합니다. 여기 코드는 다음과 같습니다jQuery가 IE8에서 이상한 동작을 추가합니다.
$(options.addButton).click(function(event) {
var prototype = $(options.prototypeContainer).attr('data-prototype');
event.preventDefault();
var fileField = $(prototype.replace(/__name__/g, fieldCount));
fieldCount++;
$(options.uploadingImagesWrapper).append(fileField);
//fileField.slideDown();
return false;
});
컨테이너의 마크 업이 같이 간다 :
<div id="uploading-component-images">
<!-- here I inserts new elements -->
</div>
<!-- the button the triggers insertion function -->
<a class="btn" href="#" id="add-another-image">{{'label.component.add_image_field'|trans }}</a>
그리고 하나의 요소 태그는 다음과 같습니다 : 여기
<div class="image-file-field">
<input type="file" name="{{ full_name }}[file]" id="{{ id }}" />
<button type="button" class="offset0_5 remove-image btn btn-mini">
<span class="icon-remove"></span>
</button>
</div>
이 스크린 샷입니다 - 어쩌면 그것으로 이해하기가 더 쉬울 것입니다.
http://joxi.ru/RFBeUtg5CbBaNyCgm14 jquery의 버전은 1.9.1입니다.
당신이 사용하고있는 jQuery를 버전을 지정하십시오. – Spudley
마크 업이 어떻게 처리되고 있습니까? 중요한 질문의 종류는 ... –
왜'event.preventDefault();'와'return false;'를 사용하는지 설명해 주시겠습니까? – Alex