无论元素的类型如何,我都想选择最后一个嵌套元素.
例:
<section>
<div></div>
<p></p>
<div></div> <-- I want this element
</section>
<section>
<div></div>
<p></p>
<a></a> <-- I want this element
</section>
<section>
<div></div>
<p></p>
<ul> <-- I want this element
<li></li>
</ul>
</section>
Run Code Online (Sandbox Code Playgroud)
我如何获得这些元素?:last-child似乎没有做到这:last-of.type一点,也没有用,因为我必须指定我想要的元素类型.
我想要元素的最后一个嵌套section元素.
这是我得到的HTML:
<div class="preview-content">
<h1 class="preview-content-header">Vorschau - Notiz1.txt <img src="icons/cross.png" /></h2>
<div>
<h2>Notiz1.txt</h2>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore …Run Code Online (Sandbox Code Playgroud) 我有一个显示数据库条目的表。用户可以为每一行打开一个弹出菜单。选项之一是删除数据库条目,表应通过 AJAX 调用相应地刷新。
只要有人单击中的#delete-toggle,我就会在 HTML 页面上进行 AJAX 调用table-popup(这table-popup是当有人单击table-edit-button表中每一行中存在的表中的 时出现的 div ):
<div class="table-popup">
<ul>
<li id="edit-toggle">Bearbeiten</li>
<li id="favorite-toggle">Zu Favoriten hinzufügen</li>
<li>Datei öffnen</li>
<li>Im Ordner öffnen</li>
<li id="delete-toggle">Löschen</li>
</ul>
</div>
<div class="main-content">
<h2 class="main-content-header">Datenbank</h2>
<div id="table">
<table>
<thead>
<tr class="table-row" tabindex="1">
<th class="fixed-header"></th>
<th>Dateiname</th>
<th>Benutzer</th>
<th>Erstelldatum</th>
<th>Änderungsdatum</th>
<th>Erste Zeile</th>
<th>Kategorie</th>
<th>Projekt</th>
</tr>
</thead>
<?php
include_once('connect.php');
$result = $connect->query("SELECT file.name AS 'filename', file.description AS 'filedescription', category.name AS 'categoryname', project.name AS 'projectname', user.name AS 'username', …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Bootstrap 3.3.6提供的glyphicons,但Chrome阻止了对它们的访问,并显示以下错误消息:
来自" http:// [:: 1] "的字体已被跨源资源共享策略阻止加载:请求的资源上没有"Access-Control-Allow-Origin"标头.原产地" :HTTP //本地主机,因此"是不允许访问.
这是我的.htaccess:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
<FilesMatch "\.(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?我编辑错了.htaccess吗?
我也尝试header("Access-Control-Allow-Origin: *");在我的header.php文件开头添加,但这也不起作用.我没有想法.
文件夹结构如下:
application
controller
model
view
header.php
index.php
footer.php
.htaccess
system
assets
css
fonts
images
js
Run Code Online (Sandbox Code Playgroud)