根据 URL id 在视图页面中突出显示特定文本
Highlight a specific text in view page depending on URL id
我应该如何突出显示 URL link 中具有与特定 ID 或文本匹配的 ID 的文本?
我有大约 50 个列表,我需要突出显示特定的 ID 或文本
不知道是用jquery写还是用codeigniter 3.
Eg.
localhost/example/admin/home/CL00074
这是我要强调的图片。
如果您不明白,请告诉我。
检查推荐
可能性二
- 这是使用段
关注 link
2.This 是使用路由
关注 link
添加到脚本 config/route.php
$路线['admin/home/(:any)'] = 'Controllername/functionname/';
假设你的 link 是 localhost/example/admin/home#CL00074 而你的 ID 进入 html 像这样:
<div id="CL00074">
</div>
,您只能使用 css 来突出显示或设置页面特定元素(div、h1、li 或其他)的样式。
使用 :target
css 标识符:
:taget{
color: black;
border: 1px solid red;
}
您可能应该使用 Code Igniter 的 URI library,它看起来像这样:
$this->uri->segment(n)
但由于这是一个 jQuery 问题,您将使用散列并以这种方式定位它:
更新您的路由: localhost/example/admin/home#CL00074
// if hash exists, check and highlight
if (window.location.hash) {
var hash = window.location.hash.replace('#', '');
$('td[id='+ hash +']').addClass('selected');
}
我应该如何突出显示 URL link 中具有与特定 ID 或文本匹配的 ID 的文本?
我有大约 50 个列表,我需要突出显示特定的 ID 或文本
不知道是用jquery写还是用codeigniter 3.
Eg.
localhost/example/admin/home/CL00074
这是我要强调的图片。
如果您不明白,请告诉我。
检查推荐
可能性二
- 这是使用段 关注 link
2.This 是使用路由 关注 link
添加到脚本 config/route.php
$路线['admin/home/(:any)'] = 'Controllername/functionname/';
假设你的 link 是 localhost/example/admin/home#CL00074 而你的 ID 进入 html 像这样:
<div id="CL00074">
</div>
,您只能使用 css 来突出显示或设置页面特定元素(div、h1、li 或其他)的样式。
使用 :target
css 标识符:
:taget{
color: black;
border: 1px solid red;
}
您可能应该使用 Code Igniter 的 URI library,它看起来像这样:
$this->uri->segment(n)
但由于这是一个 jQuery 问题,您将使用散列并以这种方式定位它:
更新您的路由: localhost/example/admin/home#CL00074
// if hash exists, check and highlight
if (window.location.hash) {
var hash = window.location.hash.replace('#', '');
$('td[id='+ hash +']').addClass('selected');
}