jquery 查找表格里的input_jquery列表文字input文本框输入关键词查找表单代码

news/2025/2/8 17:46:04 标签: jquery 查找表格里的input

特效描述:列表文字表单 文本框输入 关键词查找表单。

代码结构

1. 引入CSS

2. 引入JS

3. HTML代码

jQuery关键词查找元素高亮代码

  • 伟大的吉萨金字塔

    The Great Pyramid of Giza (also known as the Pyramid of Khufu or the Pyramid of Cheops) is the oldest and largest of the three pyramids in the Giza Necropolis bordering what is now El Giza, Egypt. It is the oldest of the Seven Wonders of the Ancient World, and the only one to remain largely intact.

  • 巴格达空中花园

    The Hanging Gardens of Babylon were one of the Seven Wonders of the Ancient World, and the only one whose location has not been definitely established.

    The Hanging Gardens were a distinctive feature of ancient Babylon. They were a great source of pride to the people, and were often described in accounts written by visitors to the city. Possibly built by King Nebuchadnezzar II in 600 BC, the gardens are believed to have been a remarkable feat of engineering: an ascending series of tiered gardens containing all manner of trees, shrubs, and vines. The gardens were said to have looked like a large green mountain constructed of mud bricks, rising from the center of the city.

  • 第九站长

    The Statue of Zeus at Olympia was a giant seated figure, about 13 m (43 ft) tall, made by the Greek sculptor Phidias around 435 BC at the sanctuary of Olympia, Greece, and erected in the Temple of Zeus there. A sculpture of ivory plates and gold panels over a wooden framework, it represented the god Zeus sitting on an elaborate cedar wood throne ornamented with ebony, ivory, gold and precious stones. It was regarded as one of the Seven Wonders of the Ancient World until its eventual loss and destruction during the 5th century AD. No copy of the statue has ever been found, and details of its form are known only from ancient Greek descriptions and representations on coins.

  • 阿耳忒弥斯神庙

    The Temple of Artemis or Artemision (Greek: Ἀρτεμίσιον, Turkish: Artemis Tapınağı), also known less precisely as the Temple of Diana, was a Greek temple dedicated to the goddess Artemis and is one of the Seven Wonders of the Ancient World. It was located in Ephesus (near the modern town of Selçuk in present-day Turkey), and was completely rebuilt three times before its eventual destruction in 401. Only foundations and sculptural fragments of the latest of the temples at the site remain.

  • Mausoleum at Halicarnassus

    The Mausoleum at Halicarnassus or Tomb of Mausolus (Persian: آرامگاه هالیکارناسوس‎; Modern Greek: Μαυσωλείο της Αλικαρνασσού; Turkish: Halikarnas Mozolesi) was a tomb built between 353 and 350 BC at Halicarnassus (present Bodrum, Turkey) for Mausolus, a satrap in the Persian Empire, and Artemisia II of Caria, who was both his wife and his sister. The structure was designed by the Greek architects Satyros and Pythius of Priene.

  • Colossus of Rhodes

    The Colossus of Rhodes /roʊdz/ (Ancient Greek: ὁ Κολοσσὸς Ῥόδιος ho Kolossòs Rhódios) was a statue of the Greek titan-god of the sun Helios, erected in the city of Rhodes, on the Greek island of the same name, by Chares of Lindos in 280 BC. It is one of the Seven Wonders of the Ancient World. It was constructed to celebrate Rhodes' victory over the ruler of Cyprus, Antigonus I Monophthalmus, whose son unsuccessfully besieged Rhodes in 305 BC. Before its destruction in the earthquake of 226 BC, the Colossus of Rhodes stood over 30 metres (98 feet) high, making it one of the tallest statues of the ancient world.

  • Lighthouse of Alexandria

    The Lighthouse of Alexandria, sometimes called the Pharos of Alexandria (/ˈfɛərɒs/; Ancient Greek: ὁ Φάρος τῆς Ἀλεξανδρείας), was a lighthouse built by the Ptolemaic Kingdom between 280 and 247 BC which was between 393 and 450 ft (120 and 137 m) tall. It was one of the tallest man-made structures in the world for many centuries, and was regarded as one of the Seven Wonders of the Ancient World. Badly damaged by three earthquakes between AD 956 and 1323, it then became an abandoned ruin. It was the third longest surviving ancient wonder (after the Mausoleum at Halicarnassus and the extant Great Pyramid of Giza) until in 1480 the last of its remnant stones were used to build the Citadel of Qaitbay on the site. In 1994, French archaeologists discovered some remains of the lighthouse on the floor of Alexandria's Eastern Harbour.

No matches were found… Try “giza”.

'use strict';

// search & highlight

;( function( $, window, document, undefined )

{

var $container = $( '.faq' );

if( !$container.length ) return true;

var $input= $container.find( 'input' ),

$notfound= $container.find( '.faq__notfound' ),

$items= $container.find( '> ul > li' ),

$item= $(),

itemsIndexed= [];

$items.each( function()

{

itemsIndexed.push( $( this ).text().replace( /\s{2,}/g, ' ' ).toLowerCase() );

});

$input.on( 'keyup', function( e )

{

if( e.keyCode == 13 ) // enter

{

$input.trigger( 'blur' );

return true;

}

$items.each( function()

{

$item = $( this );

$item.html( $item.html().replace( /([^/gi, '$1' ) );

});

var searchVal = $.trim( $input.val() ).toLowerCase();

if( searchVal.length )

{

for( var i in itemsIndexed )

{

$item = $items.eq( i );

if( itemsIndexed[ i ].indexOf( searchVal ) != -1 )

$item.removeClass( 'is-hidden' ).html( $item.html().replace( new RegExp( searchVal+'(?!([^)', 'gi' ), '$&' ) );

else

$item.addClass( 'is-hidden' );

}

}

else $items.removeClass( 'is-hidden' );

$notfound.toggleClass( 'is-visible', $items.not( '.is-hidden' ).length == 0 );

});

})( jQuery, window, document );

// toggling items on title press

;( function( $, window, document, undefined )

{

$( document ).on( 'click', '.faq h2 a', function( e )

{

e.preventDefault();

$( this ).parents( 'li' ).toggleClass( 'is-active' );

});

})( jQuery, window, document );

// auto-show item content when show results reduces to single

;( function( $, window, document, undefined )

{

var $container = $( '.faq' );

if( !$container.length ) return true;

var $input= $container.find( 'input' ),

$items= $container.find( '> ul > li' ),

$item= $();

$input.on( 'keyup', function()

{

$item = $items.not( '.is-hidden' );

if( $item.length == 1 )

$item.addClass( 'js--autoshown is-active' );

else

$items.filter( '.js--autoshown' ).removeClass( 'js--autoshown is-active' );

});

})( jQuery, window, document );


http://www.niftyadmin.cn/n/1384732.html

相关文章

Azure迁移之路--(1)本地虚拟机预算评估

Azure迁移服务评估本地工作负载以迁移到Azure。 该服务评估内部部署机器的迁移适合性,以Azure为基础,基于性能的大小,并提供在Azure中运行本地计算机的成本估算。 如果您正在考虑升级和迁移迁移,或者处于迁移的早期评估阶段&#…

056 PHP知识点总结六

49.Include和require的区别 require 外部文件如果不存在,会报错,后面的代码不会执行 Include 外部文件如果不存在,会报错,后面的代码继续执行include_once()和require_once()在加载之前要判断是否已经导入 50、索引的建立与使用索…

IAR for STM8 错误

一个IAR for STM8 v1.3 的工程&#xff0c;换到1.4版后出现如下错误 unable to allocate space for sections/blocks with a total estimated minimum size of 0x2341 bytes in <[0x008000-0x009fff]> (total uncommitted space 0x1f80). 在网上找到下面文章&#xff0c;…

[c++]setw()用法总结

setw()是用来控制后面的输出长度的。 使用需调用&#xff1a; include<iomanip> eg&#xff1a; cout<<setw(5)<<"s"<<endl; 结果为&#xff1a; s;//四个空格加一个s共占5个字符 setw()默认填充为" "(空格),可以通过setfill&a…

nes模拟器java版_【Java JDK和VirtuaNES(FC模拟器)哪个好用】Java JDK和VirtuaNES(FC模拟器)对比-ZOL下载...

fc模拟器virtuanes怎么录像打开游戏&#xff0c;在你想要开始录像的地方点上面的电影→录像(此时选择你想把录像文件放置的位置和文件名)&#xff0c;他就开始录了&#xff0c;在你想录的结尾再点电影→停止这个时候&#xff0c;在你选的位置就会出现一个.vmv文件&#xff0c;这…

OSS PostObject未发生回调的问题排查

今天排查一个问题&#xff0c;走了一些弯路&#xff0c;总结一下&#xff0c;希望可以为后来者提供参考建议。 问题&#xff1a; XX反馈&#xff0c;使用OSS PostObject的callback没有发生回调。但是通过putobject用同样的callback是有回调发生的。客户怀疑我们的PostObject有问…

如何解除 Windows 8 中的 Modern Apps 网络隔离?

在 Windows 8 中&#xff0c;我们全新引入了 WinRT 平台&#xff0c;带给用户包含动态磁贴和沉浸式用户体验的 Modern Apps。 如果您是企业用户&#xff0c;有公司的代理服务器环境&#xff0c;或者您是开发人员&#xff0c;相信您已经发现了在本地连接更换代理后&#xff0c;所…

057 PHP unset()用法详解

unset() 销毁指定的变量。注意在 PHP 3 中&#xff0c;unset() 将返回 TRUE&#xff08;实际上是整型值 1&#xff09;&#xff0c;而在 PHP 4 中&#xff0c;unset() 不再是一个真正的函数&#xff1a;它现在是一个语句。这样就没有了返回值&#xff0c;试图获取 unset() 的返…