我有以下文件结构
WebContent-> Bootstrap ->
js
CSS
图片
WebContent->index.jsp
以下两个网址都无法帮助解决未定义的属性错误。
Undefined attribute name (data-toggle)
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Insert title here</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<button type="submit" class="btn btn-default">Submit</button>
<span class="label label-primary">Primary</span>
<span class="label label-success">Success</span>
<span class="label label-info">Info</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
<a href="#">Inbox <span class="badge">42</span></a>
</div>
<div class="jumbotron">
<h1>Hello, world!</h1>
<p>...</p>
<p><a class="btn btn-primary btn-lg" role="button">Learn more</a></p>
</div>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Action</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Another action</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Something else here</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Separated link</a></li>
</ul>
</div>
</body>
</html>
下面列出了 Eclipse 版本详细信息。 Spring工具套件
版本:3.6.1.RELEASE 版本号:201408250818 平台:Eclipse Luna (4.4)
版权所有 (c) 2007 - 2014 Pivotal Software, Inc. 版权所有。访问http://spring.io/tools/sts
该产品包含由 Apache 软件基金会 http://www.apache.org
最佳答案
您的文档类型
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
适用于 HTML 4.01。
data-*
attributes在 HTML 5 中添加。The doctype for HTML 5基本上是要么
<!DOCTYPE html>
或
<!DOCTYPE html SYSTEM "about:legacy-compat">
您的 IDE 也很可能不了解 HTML 5 及其许多更改。
关于jquery - 未定义的属性名称(角色),eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26209286/