TinyMCE를 textarea 요소에 적용하는 데 문제가 있습니다. 승객 명단이있는 페이지가 있습니다. 승객을 클릭하면 AJAX가 호출되고 승객에 대한 정보가 표시됩니다. 한 필드는 텍스트 영역 요소입니다. 내 문제는 당신이 클릭 한 첫 번째 승객 (모든 승객)이 TinyMCE를로드하지만, 여기에서 TinyMCE가 적용되지 않은 일반 텍스트 영역 일뿐입니다. 나는 무슨 일이 일어나고 있는지 모른다. 여기에 내가 가지고있는 다음 코드가있다 :TinyMCE가 AJAX 호출의 요소에 추가되지 않음
j$ = jQuery.noConflict();
j$(document).ready(function(e) {
tinyMCE.init({
mode : "textareas",
theme : "advanced",
theme_advanced_buttons1 : "bold, italic, underline, | ,bullist, numlist, | ,outdent, indent, | ,link, unlink, |, code",
relative_urls : false,
remove_script_host : false,
});
j$('.names strong').click(function(e) {
//Find passenger ID
var customer_ID = j$(this).closest('.passenger_Container').find("input[name='customer_ID']").val();
//Find placement of returned data
var insert_Data = j$(this).closest('.passenger_Container').find('.package');
j$.ajax({
type: "POST",
url: "/include/passenger_Detail.php",
data: { customer_ID_Data : customer_ID },
success: function(data) {
//get returned data and add into appropriate place
insert_Data.html(data);
var oldEditor = tinyMCE.get('notes');
if (oldEditor != undefined) {
tinymce.remove(oldEditor);
}
tinyMCE.execCommand('mceAddControl', false, 'notes');
//re-initialise WYSIWYG editor. Notes is the ID to re-initialize
/*tinymce.execCommand('mceRemoveControl',true,'notes');
tinymce.execCommand('mceAddControl',true,'notes');*/
}
});
});
});
<!-- content is displayed using PHP while loop -->
<div class="passenger_Container bottom-buffer">
<div class="names row">
<div class="col-xs-1 text-center">
<!-- Display checkbox -->
</div>
<div class="col-xs-4 col-sm-3">
<strong><?php echo $row['f_Name'].' '.$row['l_Name']; ?></strong> </div>
<div class="col-xs-3 hidden-xs">
<!-- display child names -->
</div>
<div class="col-xs-3">
<!-- Display order status -->
</div>
<div class="col-xs-1 col-sm-2">
<!-- Display form -->
</div>
</div>
<div class="package custom-well well-sm top-buffer">
<!-- passenger detail goes here. You will find the code in includes/passenger_Detail.php -->
</div>
</div>
<!-- end PHP while loop -->
내가 남긴 TinyMCE를 작동 시키려고 노력했다. 나는 나쁜 코딩 관행이 범죄자라는 의심을 가지고있다. 각각의 텍스트 영역에는 원인이라고 생각되는 #notes의 ID가 있습니다. 하지만 문서를 보면 tinyMCE가 클래스를 사용하여 텍스트 영역을 타겟팅 할 수 있다고 생각하지 않습니다. 모든 텍스트 영역을 반복해야하지 않는 한. 나는 여기에 뱉어 내고있다.
자세한 정보가 필요하면 알려주십시오. 다시 한번 감사드립니다.