jQuery input文本框三级联动地区选择下拉菜单代码

来源:https://www.sucaihuo.com//js/2200.html 2017-06-19 18:23浏览(2950) 收藏

jQuery input文本框三级联动地区选择下拉菜单代码,注意这不是select下拉选择菜单,而是input文本框实现的,除了做地区三级联动效果,还可以运用于商品分类选择等等。
jQuery input文本框三级联动地区选择下拉菜单代码
分类:表单代码 > 三级联动 难易:初级
查看演示 下载资源 下载积分: 20 积分

js代码

<script src="js/jquery-1.8.2.min.js"></script>
<script>
$(function(){
	function select_simulated(select_style,bomb_con_style){
		$(document).click(function(){
			$(bomb_con_style).hide();
			})
		$(select_style).live('click',function(e){
			var thisinput=$(this);
			var local=$(this).position();
			var bomb_con=$(bomb_con_style);
				$(this).parents("li").siblings().find(bomb_con_style).hide();
				$(this).parent().find(bomb_con_style).width($(this).width());//下拉框的宽度
				$(this).parent().find(bomb_con_style).show();
				e?e.stopPropagation():event.cancelBubble = true;
				bomb_con.find("dd").click(function(e){
				var bomb_text=$(this).text();
				$(this).addClass("selected").siblings().removeClass("selected");
				$(this).parents(bomb_con_style).hide();
				$(this).parents("li").find(select_style).val(bomb_text);
				e?e.stopPropagation():event.cancelBubble = true;
				
		});	
		});
		 return false;
	}
	select_simulated(".provin_select",".provin_con");
	
	  
	$(".local").focus(function(){
		$(this).addClass("local3");
	});
	$(".local").blur(function(){
		$(this).removeClass("local3");
	});
	})
</script>
评论0
头像

系统已开启自动识别垃圾评论机制,识别到的自动封号,下载出错或者资源有问题请联系全栈客服QQ 1915635791

1 2