<meta charset="UTF-8">
<title>产品录入</title>
<link href="css/input.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#search div:nth-child(1){
float: left;
width: 100px;
padding-right: 10px;
text-align: right;
}
#search div:nth-child(2){
width: 150px;
margin-left: 110px;
}
#submit input{
width: 268px;
}
</style>
<script type="text/javascript" src="jquery-3.1.1.min.js"></script>
<!-- <script type="text/javascript" src="js/jquery-3. 1.1.min.js"></script> -->
*<script type="text/javascript">
$().ready(function(){
//注册事件
$("#submit input").click(function () {
var searchText = $("#search input").val();
if(searchText == ""){
$("#error").text("产品名称必须输入"); //方法1
$("#error").css("color", "#ff0000");
}
//else if(/\d/.test(searchText)){ //方法a
else if(new RegExp("\\d").test(searchText)){ //方法b
$("#error").html("<span style='color:#ff0000'>产品名称中不能有数字</span>"); //方法2
}
else{
window.location.href = "product.html";
}
});
});
</script>*
<div>产品名称</div>
<div><input type="text" placeholder="请输入产品名称"></div>