jquery中 $.expr使用實(shí)例介紹
更新時(shí)間:2014年06月09日 10:17:12 作者:
這篇文章主要以示例介紹了jquery中 $.expr使用,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<meta name="generator" content="editplus" />
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title></title>
<link type="text/css" href="../../themes/base/jquery.ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.4.2.js"></script>
<script type="text/javascript" src="../../external/jquery.bgiframe-2.1.1.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.core.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.mouse.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.position.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.resizable.js"></script>
<script type="text/javascript" src="../../ui/jquery.ui.dialog.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
//初始測試數(shù)據(jù)
var init=function(){
$("#con1").add("#con3").data("key","10001");
};
init();
var select="mytest";
var name="key";
//定義一個(gè)新選擇器
$.expr[ ":" ][ select ] = function( elem ) {
return !!$.data( elem, name );
};
//使用
$("div:mytest").each(function(){
alert(this.id);//結(jié)果:con1 con3
})
});
</script>
</head>
<body>
<div id="con1"></div>
<div id="con2"></div>
<div id="con3"></div>
</body>
</html>
</body>
</html>
相關(guān)文章
Jquery利用mouseenter和mouseleave實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出層且可以點(diǎn)擊
這篇文章主要介紹了Jquery利用mouseenter和mouseleave實(shí)現(xiàn)鼠標(biāo)經(jīng)過彈出層且可以點(diǎn)擊。需要的朋友可以過來參考下,希望對大家有所幫助2014-02-02
jQuery UI實(shí)現(xiàn)動畫效果代碼分享
這篇文章給大家總結(jié)了jQuery UI實(shí)現(xiàn)動畫效果的實(shí)例代碼,有需要的朋友們可以參考測試下。2018-08-08
淺談jQuery中的$.extend方法來擴(kuò)展JSON對象
下面小編就為大家?guī)硪黄獪\談jQuery中的$.extend方法來擴(kuò)展JSON對象。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2017-02-02
jquery實(shí)現(xiàn)垂直無限輪播的方法分析
這篇文章主要介紹了jquery實(shí)現(xiàn)垂直無限輪播的方法,結(jié)合實(shí)例形式分析了jQuery無限輪播相關(guān)界面布局、樣式與頁面元素動態(tài)操作實(shí)現(xiàn)技巧,需要的朋友可以參考下2019-07-07
jQuery的實(shí)例及必知重要的jQuery選擇器詳解
下面小編就為大家?guī)硪黄猨Query的實(shí)例及必知重要的jQuery選擇器詳解。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05

