获取一组radio被选中项的值
var item = $(‘input[@name=items][@checked]‘).val();
获取select被选中项的文本
var item = $(“select[@name=items] option[@selected]“).text();
select下拉框的第二个元素为当前选中值
$(‘#select_id’)[0].selectedIndex = 1;
radio单选组的第二个元素为当前选中值
$(‘input[@name=items]‘).get(1).checked = true;
继续阅读 »
最近在玩這個東西, 不過我真正開始玩 jQuery 還不滿一個月
很多功能也不知道是不是已經有了, 例如在關閉 dialog 之後
如果關閉前有移動過位置, 再開啟時 dialog 的位置卻會回到最初設定的
不會自動在最後移動的位置, 雖然可以在 dragStop 事件做這個處理
但是如果每次開個 dialog 都還要另外處理也是很麻煩的啊
估狗爬了好久, 找不到比較好的解決方式
於是就直接拿 jQuery source code 開刀..
继续阅读 »
/*!
* Auto Complete 4.1
* October 25, 2009
*/
;(function($, undefined){
var tempvalue=”;
// Expose autoComplete to the jQuery chain
$.fn.autoComplete = function(){
// Force array of arguments
var args = Array.prototype.slice.call(arguments);
// Autocomplete special triggers
if (typeof args[0] === ‘string’)
// Trigger the requested function, and dont break the chain!
return $(this).trigger(‘autoComplete.’+args.shift(), args);
// Initiate the autocomplete
return autoComplete.call(this, args[0]);
};
// bgiframe is needed to fix z-index problem for IE6 users.
$.fn.bgiframe = $.fn.bgiframe ? $.fn.bgiframe : $.fn.bgIframe ? $.fn.bgIframe : function(){
// For applications that don’t have bgiframe plugin installed, create a useless
// function that doesn’t break the chain
return this;
};
// Autocomplete function
var inputIndex = 0, autoComplete = function(options){
return this.each(function(){
// Cache objects
var $input = $(this).attr(‘autocomplete’, ‘off’), $li, timeid, timeid2, blurid,
// Internal Per Input Cache
cache = {
length: 0,
val: undefined,
list: {}
}, 继续阅读 »
近期评论