Я пытаюсь получить элемент с его ID или класса, но без успеха ...CKEditor - Получить элемент по Id или класса
Не удается прочитать свойство «GetByID» неопределенной
я следовать инструкциям здесь: CKEDITOR docs GetById()
Вот мой код:
$(document).ready(function() {
ckeditor_init();
});
var $textarea = $('#tiny_mce_block').find('textarea').attr('id');
function ckeditor_init() { // This works
CKEDITOR.replace($textarea, {
language: 'fr',
allowedContent: true,
});
var editor = CKEDITOR.instances[$textarea]; // This works
var $dataCkeditor = editor.getData(); // This works
var el = $(editor.document.getById('2')); // This doesn't work !
console.log(el);
}
FIDDLE: http://jsfiddle.net/B4yGJ/395/
В моих $dataCkeditor = editor.getData();
я это:
<span class="st" id="1" data-time-start="0.29" data-time-end="1.259" data-time-moy="0.1938">mardi </span>
<span class="st" id="2" data-time-start="2.048" data-time-end="5.406" data-time-moy="0.10832258064516">qualité sécurité efficacité </span>
Как я могу выбрать элемент либо идентификатор (в моем случае "2"
) или класс (в моем случае, например "st"
) и после получения "data-time-start"
?
спасибо!
Можете ли вы возиться со своим кодом? –
Поместите '$ textarea = $ ('# tiny_mce_block')' inside '$ (document) .ready'. Это его единственная цель. –
Я сделал это, но эта же проблема – Zagloo