2014-09-13 27 views
0

在下面的代碼中,我嘗試處理複選框上的單擊事件。我期望在javascript控制檯中看到打印出的單詞「hello」,但是我什麼都看不到。我如何修改代碼以獲取print語句執行?如何觸發並處理點擊事件?

let checkGroupByRounds = Dom_html.createInput ~_type:(Js.string "checkbox") doc in 
    Lwt_js_events.clicks checkGroupByRounds (fun event event_loop -> 
    Lwt.return (Printf.printf "hello")); 
    Dom.appendChild container checkGroupByRounds; 

回答

1

你需要用一個新行Printf.printf "hello\n"或顯式沖水flush stdout刷新標準輸出。