0
我正在使用EditArea編輯器。有功能:editAreaLoader.execCommand
,它收到編輯器的id和帶參數的命令。因此,代碼:遇到函數調用問題
$(document).ready(function() {
// Call go to line function after click at button
$('#line_go').click(function() {
console.log($('#line_to').val());
editAreaLoader.execCommand('example_1', 'go_to_line', $('#line_to').val());
});
// Try to do the same but after loading of the page
editAreaLoader.execCommand('example_1', 'go_to_line',$('#line_to').val());
});
HTML:
<input type="edit" name="line" id="line_to" value="15" />
<input type="button" name="line_go" id="line_go" value="Go" />
所以,當加載頁面沒有任何反應。但是當我點擊按鈕編輯器去行#15(或其他東西,如果我改變它)。 console.log
顯示15
。
例如,當我使用alert包裝execCommand
(第二個,它在頁面加載後調用)時,它返回false。
有什麼問題嗎?爲什麼頁面加載後返回錯誤?謝謝。
是的,你是對的,謝謝。 – Ockonal 2011-03-06 11:41:07