jquery 无限极联动【地区】
2017-01-08 20:10
246 查看
<select name="region[]" class="region" > <option value="">--请选择--</option> <?php foreach ($region_data as $k => $val): ?> <option value="<?php echo $val->region_id?>"><?php echo $val->region_name?></option> <?php endforeach ?> </select> <script> $(function(){ $(document).on('change','.region',function(){ var region_id=$(this).val(); var _this=$(this); if (region_id<0) { _this.nextAll().remove(); return false; } $.post('publish_position',{'region_id':region_id},function(msg){ console.log(msg); if (msg.length>0) { str='<select name="region[]" class="region">'; str+='<option value="-1">--请选择--</option>'; $(msg).each(function(k,v){ str+='<option value='+v.region_id+'>'+v.region_name+'</option>'; }) str+='</select>' _this.nextAll().remove(); _this.after(str); } },"json") }) }) </script>
相关文章推荐
- jQuery实现特殊下拉菜单
- jQuery_基本选择器
- javascript dom对象和jQuery对象的转换
- 【原】jQuery编写插件
- jquery 常用事件添加方式和自定义事件
- Jquery事件绑定基本案例
- js实现 jquery的$.ajax
- Jquery的extend函数的简单应用
- Jquery过滤器的基本使用案例
- Myeclipse里导入jQuery.js 时出现错误打红叉的解决方法
- jquery遍历筛选数组的几种方法和遍历解析json对象
- Jquery操作下拉列表和复选框,自定义下拉
- jquery.zclip轻量级复制失效问题
- Ajax 技术详解
- jquery中attr和prop的区别
- JavaScript & jQuery完美判断图片是否加载完毕
- 纯javaScript、jQuery实现个性化图片轮播【推荐】
- jquery.nivo.slider轮播插件使用
- jquery序列化表单数据
- Jquery实现的一个DIV层面板的折叠/展开效果