⑴ 我想用jquery 查找頁面所有的輸入框,要怎麼寫

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(function(){
$("input:text").each(function(){
var name = $(this).attr("name");
alert(name);
});
});
</script>
</head>
<body>
<input type="text" name="1"/><br />
<input type="text" name="2"/><br />
<input type="text" name="3"/><br />
<input type="text" name="4"/><br />
</body>

</html>
這里有個例子 你看下

⑵ jquery怎麼實現搜索框搜索功能

jquery怎麼實現搜索框搜索功能示例代碼L:
(function($) {
$.fn.Z_TMAIL_SIDER_V2 = function(options) {
var opts = $.extend( {}, $.fn.Z_TMAIL_SIDER_V2.defaults, options);
var base = this;
var thisTitle = $(base).find('.allcategorys');
var Z_SubList = $(base).find('.sublist');
var navPosTop = $(base).offset().top;
var timeOut = null;

$(thisTitle).find('.title-item-hd a').hover(function(e) {
clearTimeout(timeOut);
var thisLi = this;
if($(Z_SubList).is(':visible')) return;
showSubList(thisLi);
e.stopPropagation();
}, function(e) {
var thisLi = this;
timeOut = setTimeout(function() {
hideSubList(thisLi);
}, 100);

$(Z_SubList).hover(function(e){
clearTimeout(timeOut);
}, function() {
clearTimeout(timeOut);
timeOut = setTimeout(function() {
hideSubList(thisLi);
}, 100);
});
e.stopPropagation();
});

var showSubList = function(thisli) {
var top = $(thisli).height() - opts.slideHeight;
$(thisli).addClass('curr').find('s').addClass('curr');
$(Z_SubList).css({top: top, opacity: 0}).show().stop().animate({top: $(thisli).height(), opacity : 1});
};

var hideSubList = function(thisli) {
$(thisli).removeClass('curr').find('s').removeClass('curr');
$(Z_SubList).hide();
};

$(window).resize(function() {
var sTop = $(window).scrollTop();

if(sTop >= navPosTop) {
if($.browser.msie && $.browser.version < 7){
$(base).css({position: 'absolute', top: sTop});
}else {
$(base).css({position: 'fixed', top: 0});
}
}else {
$(base).css({position: 'relative', top: 0});
}
});

$(window).scroll(function() {
var sTop = $(window).scrollTop();

if(sTop >= navPosTop) {
if($.browser.msie && $.browser.version < 7){
$(base).css({position: 'absolute', top: sTop});
}else {
$(base).css({position: 'fixed', top: 0});
}
}else {
$(base).css({position: 'relative', top: 0});
}
});
};

$.fn.Z_TMAIL_SIDER_V2.defaults = {
slideHeight : 8
};
})(jQuery);

⑶ jquery插件 網站內部搜索框帶有多平台切換按鈕搜索

jquery怎麼實現搜索框搜索功能示例代碼L:(function($){$.fn.Z_TMAIL_SIDER_V2=function(options){varopts=$.extend({},$.fn.Z_TMAIL_SIDER_V2.defaults,options);varbase=this;varthisTitle=$(base).find('.allcategorys');varZ_SubList=$(base).find('.sublist');varnavPosTop=$(base).offset().top;vartimeOut=null;$(thisTitle).find('.title-item-hda').hover(function(e){clearTimeout(timeOut);varthisLi=this;if($(Z_SubList).is(':visible'))return;showSubList(thisLi);e.stopPropagation();},function(e){varthisLi=this;timeOut=setTimeout(function(){hideSubList(thisLi);},100);$(Z_SubList).hover(function(e){clearTimeout(timeOut);},function(){clearTimeout(timeOut);timeOut=setTimeout(function(){hideSubList(thisLi);},100);});e.stopPropagation();});varshowSubList=function(thisli){vartop=$(thisli).height()-opts.slideHeight;$(thisli).addClass('curr').find('s').addClass('curr');$(Z_SubList).css({top:top,opacity:0}).show().stop().animate({top:$(thisli).height(),opacity:1});};varhideSubList=function(thisli){$(thisli).removeClass('curr').find('s').removeClass('curr');$(Z_SubList).hide();};$(window).resize(function(){varsTop=$(window).scrollTop();if(sTop>=navPosTop){if($.browser.msie&&$.browser.version=navPosTop){if($.browser.msie&&$.browser.version<7){$(base).css({position:'absolute',top:sTop});}else{$(base).css({position:'fixed',top:0});}}else{$(base).css({position:'relative',top:0});}});};$.fn.Z_TMAIL_SIDER_V2.defaults={slideHeight:8};})(jQuery);

⑷ jquery 搜索框,搜索表格中的數據

//參考下這個,一個正在用的項目的。後台就模糊查詢把結果返回來就可以了

$('.searchInp').live('keyup',function(){
varv=$.trim($(this).val());
if(!v)returnfalse;
varobj=$(this),data={action:'search',,name:v};
obj.addClass('searchSelectLj')
if(obj.attr('way'))data['way']=obj.attr('way');
if(obj.attr('m'))data['m']=obj.attr('m');
$.ajax({
type:'post',data:data,dataType:'json',beforeSend:function(XMLHttpRequest){
$('.searchSelect').html('<p>搜索「'+v+'」中</p>');
},success:function(msg){
if(msg.error>0){
$('.searchSelect').html('<p>搜索無結果</p>');
}else{
if(msg.data){
varhtml='<p>搜索共('+msg.data.length+')結果</p>';
$.each(msg.data,function(k,v){
if(v.o)
html+='<p><inputtype="hidden"value="'+v.id+'"><inputtype="hidden"value="'+v.o+'">'+v.name+'</p>';
else
html+='<p><inputtype="hidden"value="'+v.id+'">'+v.name+'</p>';
})
$('.searchSelect').html(html);
}else{
$('.searchSelect').html('<p>搜索無結果</p>');
}
}
},error:function(){

}
})
})

⑸ jquery帶搜索框的下拉菜單怎麼寫

我提供一個簡單的思路。一般下拉框用select.不過select不智能,所以大家開始用一個text文本框加一個ul來模擬。

⑹ 仿百度搜索框使用jquery什麼事件

有這么一個插件你可以看一下:仿網路自動補全搜索框效果

⑺ Jquery 搜索Json內容 與文本框輸入匹配,並在頁面顯示

jquery獲取用戶輸入的內來容:
var name=$("#文本框源ID").val();
使用循環查JSON,
for(){
if(json.name==name){//條件
//顯示其它屬性
$("#文本框ID").val(json.名稱);
.....
}
}
把上面中文的字換成你定義的變數名。

⑻ jquery mobile實現帶搜索功能的下拉框求代碼

分割的下拉菜單按鈕
<div style="padding: 100px 100px 10px;">
<form class="bs-example bs-example-form" role="form">
<div class="row">
<div class="col-lg-6">
<div class="input-group">
<div class="input-group-btn">
<button type="button" class="btn btn-default" tabindex="-1">下拉菜單</button>
<button type="button" class="btn btn-default

dropdown-toggle" data-toggle="dropdown" tabindex="-1">
<span class="caret"></span>
<span class="sr-only">切換下拉菜單</span>
</button>
<ul class="dropdown-menu">
<li>
<a href="#">功能</a>
</li>
<li>
<a href="#">另一個功能</a>
</li>
<li>
<a href="#">其他</a>
</li>
<li class="divider"></li>
<li>
<a href="#">分離的鏈接</a>
</li>
</ul>
</div><!-- /btn-group -->
<input type="text" class="form-control">
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
<br>
<div class="col-lg-6">
<div class="input-group">
<input type="text" class="form-control">
<div class="input-group-btn">
<button type="button" class="btn btn-default" tabindex="-1">下拉菜單</button>
<button type="button" class="btn btn-default

dropdown-toggle" data-toggle="dropdown" tabindex="-1">
<span class="caret"></span>
<span class="sr-only">切換下拉菜單</span>
</button>
<ul class="dropdown-menu pull-right">
<li>
<a href="#">功能</a>
</li>
<li>
<a href="#">另一個功能</a>
</li>
<li>
<a href="#">其他</a>
</li>
<li class="divider"></li>
<li>
<a href="#">分離的鏈接</a>
</li>
</ul>
</div><!-- /btn-group -->
</div><!-- /input-group -->
</div><!-- /.col-lg-6 -->
</div><!-- /.row -->
</form>
</div>
具體見http://www.runoob.com/bootstrap/bootstrap-input-groups.html

⑼ Jquery仿斗魚搜索框的,拉長效果

給它加個點擊事件,讓它點擊後變長。
再加個鍵盤事件,讓它鍵盤輸入的時間默認的文字消失。

⑽ jquery如何實現動態搜索顯示內容

$(document).ready(function () {

var showletter = "";

$(".showkeyword").keyup(function () {

var formletter = /[a-z]$/;

if (!formletter.test($(this).val())) {

if (showletter != $(this).val()) {
showletter = $(this).val();
showsearch(showletter);

}

}

});

function showsearch(keywors) {
/* url為搜索請求的地址,自定義*/
$.ajax({
type: "get",
url: "/ashx/Searchtishi.ashx",
data: { keywords: keywors },
contentType: "html/text; charset=utf-8",
dataType: "text",
success: function (data) {

//將返回的搜索結果,放入到我們指定的div裡面
$(".searchlist ul").html(data);
}
});

}
});
<script type="text/javascript" src="http://www.sz886.com/js/jquery-1.9.1.min.js"></script>