JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<script src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<script>
(function($){
function formatValue(target){
var t = $(target);
var opts = t.textbox('options');
var v = t.textbox('getValue');
if (opts.formatter && v){
var v = opts.formatter.call(target, v);
t.textbox('setText', v);
}
}
var focusHandler = $.fn.textbox.defaults.inputEvents.focus;
$.extend($.fn.textbox.defaults.inputEvents, {
focus: function(e){
if (focusHandler){focusHandler(e);}
var t = $(e.data.target);
var v = t.textbox('getValue');
if (v){t.textbox('setText', v);}
}
});
var initValue = $.fn.textbox.methods.initValue;
$.fn.textbox.methods.initValue = function(jq, value){
initValue.call($.fn.textbox.methods, jq, value);
return jq.each(function(){
var opts = $(this).textbox('options');
formatValue(this);
opts.value = value;
});
}
})(jQuery);
</script>
<input id="t1">
JavaScript
$('#t1').textbox({
value:123,
formatter:function(value){
return '>>'+value;
}
})