0

これらの動的に作成されたテキストエリアを CEditor フィールドにしようとすると、エラーが発生します: TypeError: b is undefined

私のコード:

    var input = $("<textarea>").addClass("textAreaClassTest");
    //input.setAttribute("id", "como");
    //input.setIdAttribute("id", "como");
    //input.ID = 'como';
    CKEDITOR.replace('como');
    item.append(input);
    //CKEDITOR.replace('como');

    return item;

テキストエリアにIDを与えることはできないようです-任意のIDです:)

4

1 に答える 1

0

jQuery を使用していて、一度に 1 つ以上のテキスト領域しか操作していないとします。したがって、テキスト領域を取得して ID を割り当て、以下のように使用できます。

//select all text areas
var input = $("textarea");
var list = new Array();
var count = 0;

input.each(function () {
    count++;
    $this = $(this);
    $this.attr("id", "como" + count);
    console.log('id is "' + $this.attr("id") + '" and text is "' + $this.text() + '"');
    CKEDITOR.replace($this.attr("id"));
    list.push($this.attr("id"));
});
//return the list of replaced text area ids
return list;
于 2013-04-23T14:50:18.227 に答える