You should put your code inside $(document).ready() block.
$(document).ready(function(){
var t = $('#write_input');
t.textbox('textbox').bind('keydown', function(e){
if (e.keyCode == 13){ // when press ENTER key, accept the inputed value.
t.textbox('setValue', $(this).val());
}
});
})