HTML代码
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../js/20170523/pb_1.js"></script>
<title>Insert title here</title>
</head>
<body>
<form id="MTform">
<div id="newinput"></div>
<br>
<button id="newpren">newpren</button>
<button id="oldclass">oldclass</button>
</form>
<button id="submit">提交</button>
</body>
</html>
JS代码
$(function(){
$("form button").click(
function() {
if ($(this).attr("id") === "input_1") {
$("#newinput").append(
"<input id=\"newclass\" placeholder=\"input_1\" type=\"text\"/>");
}
if ($(this).attr("id") === "input_2") {
$("#newinput").append(
"<input id=\"oldclass\" placeholder=\"input_2\" type=\"text\"/>");
}
});
});
为什么在Google浏览器中会在成这种现象,360就没事呢?还是我代码哪里写的有问题?