yii框架下使用bootstrap时,判断checkbox、radioButtonList和dropDownList的js方法
来源:互联网 发布:中国人娶沙特美女知乎 编辑:程序博客网 时间:2024/06/10 20:02
1、首先设置button按钮的id:
<span style="font-size:14px;">'htmlOptions'=>array('id'=>'buttonStateful')</span>
例如:
<span style="font-size:14px;"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'提交', 'htmlOptions'=>array('id'=>'buttonStateful'))); ?></span>
2、对checkbox是否选中和选中值判定
<span style="font-size:14px;"><script type="text/javascript">$('#buttonStateful').click(function(){ var cblists = $("[id *= Tice_modules]"); var module= ''; for (var i=0; i<cblists.length; i++) { if (cblists[i].checked) { if (module != ''){ module += ','; } module += cblists[i].value; } }if(module){url = "/controller/action?id=<?php echo $_GET['id'];?>&module=" + module;window.location.href = url;}else{alert('先选择模块');}});</script> </span>
3、对checkbox是否选中判定
<span style="font-size:14px;"><script type="text/javascript">$('#buttonStateful').click(function(){ var location = $("[id *= unit_location]"); var result = false; for (var i = 0; i < location.length; i++) { if (location[i].checked) { result = true; break; } } if(result == false){alert('请选择Unit Location'); }});</script> </span>
4、判断dropDownList中选中了哪一个
<span style="font-size:14px;"><script type="text/javascript">$('#buttonStateful').click(function() {module = $('#theproject').find('option:selected').text();if (module){var btn = $(this); btn.button('loading'); // call the loading functionurl = '/controller/action?id=<?php echo $id;?>&module=' + module;window.location.href=url;}else{alert('先选择模块');}});</script> </span>
0 0
- yii框架下使用bootstrap时,判断checkbox、radioButtonList和dropDownList的js方法
- RadioButtonList \DropDownList 的JS访问
- js操作DropDownList 与 RadioButtonList
- checkbox和radio的js统一判断为空方法
- ASP.NETmvc5下使用DropDownList的使用 ,和asp.net里的DropDownList控件的方法
- 使用yii框架开发第一步:配置yii框架环境和bootstrap扩展,使用代码生成器。
- 配置yii框架环境和bootstrap扩展,使用代码生成器。
- yii框架下bootstrap的配置(ckeditor)
- yii中yii-bootstrap的使用
- Windows 环境下Yii框架的使用
- Yii框架下配置最新版yii-bootstrap组件
- RadioButtonList和CheckBoxList的JS操作
- Asp.net 控件用法汇总-RadioButtonList、DropDownList、button、Checkbox...
- ASP.NET中JS获取服务器控件radiobuttonlist和DropDownList选中值
- JS判断RadioButtonList是否选中
- js 获取 asp.net 服务器端控件 Label 与 TextBox RadioButtonList 与 DropDownList 的值
- js 获取 asp.net 服务器端控件 Label 与 TextBox RadioButtonList 与 DropDownList 的值
- js 获取 asp.net 服务器端控件 Label 与 TextBox RadioButtonList 与 DropDownList 的值
- SAX解析xml文件
- C语言中的有符号数与无符号数
- 分支-20. 计算符号函数的值(10)
- GeeksforGeeks Sort an array according to the order defined by another array
- 循环-22. 输出闰年(15)
- yii框架下使用bootstrap时,判断checkbox、radioButtonList和dropDownList的js方法
- ios应用启动后的自动版本检测方式
- vagrant 打包 box
- 循环-23. 找完数(20)
- 黑马程序员-线程
- 攀比心
- 结构体字节对齐
- 静态普通方法名匹配切面
- 2.1.11 Remove Element