由於要用UiKit的markdwon模塊編輯器,因此接觸了CodeMirror
下面是事件綁定的基本寫法,和jQuery接近.編輯器
var textarea = document.getElementById('block'); var editor = CodeMirror.fromTextArea(textarea, { lineNumbers: false, content: textarea.value, }); editor.on("blur", function(){ console.log("onBlur"); });