代码:
$('#model_name').blur(function() {
$(this).val(toLine($(this).val()));
});
function toLine(name) {
name = name[0].toUpperCase() + name.substr(1)
return name.replace(/\_(\w)/g, function(all, letter){
return letter.toUpperCase();
});
}