<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div>
<input type="text" class="inp_xm_0">
</div>
<script src="jquery-3.2.1.min.js"></script>
<script>
$('.inp_xm_0').blur(function(e){
var text = $(this).val();
var ex = new RegExp("^[\u4e00-\u9fa5]+$")
if (!ex.test(text)){
alert('只能输入文字,开头结尾不能有空格')
}
});
</script>
</body>
</html>