javascript - 如何在表格中搜索 HTML img 标题属性?
问题描述
** 第 1、第 2 和第 3 列搜索栏是可操作的。我的AssignedUser
列由图像及其标题(用户名)组成,当您将光标移到它们上方时会出现这些标题。如何修复此列中的搜索栏?
这是我在第一、第二和第三列中搜索时使用的 Javascript 代码;**
var column = $(this);
$('#userList1 thead tr').clone(true).appendTo('#userList1 thead');
$('#userList1 thead tr:eq(1) th').each(function (i) {
var title = $(this).text();
var thID = $(this).attr('id');
if (thID != "nosearch"/* && thID != "selectoption"*/) {
$(this).html('<input type="text" placeholder="Search " id="searchbox"/>');
$('input', this).on('keyup change', function () {
if (table.column(i).search() !== this.value) {
table
.column(i)
.search(this.value)
.draw();
}
});
}
我的img
标签如下;
if (item.AssignedUserPhoto != "") {
<img id="profilePhotoimg" name="@item.AssignedUserID" src="@item.AssignedUserPhoto" value="@item.ID" title="@item.AssignedUserNAme")" />
}
解决方案
推荐阅读
- python - pycharm:如何在项目文件中包含库
- php - 日期范围明智地获取数据
- extjs - Sencha Architect “无法打开您的 app.json 文件”
- python - 如何让控制台“记住” Python 中的用户输入?
- java - 用于 postgreSQL 的 jdbc 驱动程序的 Jar 文件未出现在数据库连接的 JAR 列表中(eclipse)
- reactjs - 路由器在使用 WebRTC 的 React 应用程序中无法正常运行
- discord - discord.js 节点通过用户名获取用户
- angular - Angular 12 HttpInterceptor 等到http客户端方法完成
- python - 通过加入 ArcGIS 表更新 SQL 表时出错
- chart.js - chart.js 如何强制最小和最大 y 轴值