如何获取我页面中所有下拉列表的选定索引 [英] How to get the selected index of all the dropdowns in my page

查看:111
本文介绍了如何获取我页面中所有下拉列表的选定索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所有iam在我的网页中进行工具提示类型验证,其中我需要获取所有Dropdown选择索引,如果下拉选择索引为-1则我应该打开工具提示,逻辑对于工具提示工作正常,但如何获得我所有下拉的选定项目索引,我尝试了这样的东西没有工作。

请帮助我。如果我得到全部警报至少下拉选择索引就可以了。



<前lang =Javascript> var parentsa = $(' #aspnetForm');
$( 输入,选择,parentsa).mouseover( function (){
var selected = $( 输入,选择,parentsa).options [$( 输入,选择,parentsa).selectedIndex] .value;

$( 输入,选择,parentsa).tooltip( open) ;
alert(已选中);

});

解决方案

' #aspnetForm');


input,选择,parentsa).mouseover( function (){
var selected =


输入,选择,parentsa).options


Hi,
All iam doing an tooltip type validation in my webpage in which i need to get all Dropdowns selected index ,if dropdown selected index is -1 then i should open an tooltip ,the logic for tool tip is working fine,but how to get the selected item index of all my drop downs, i tried something like this didnt workedout.
Pls help me out.atleast in the alert if i get all the dropdowns selected index it will be fine.

var parentsa = $('#aspnetForm');
                          $("input,select", parentsa).mouseover(function () {
                              var selected = $("input,select", parentsa).options[$("input,select", parentsa).selectedIndex].value;
                             
                              $("input,select", parentsa).tooltip("open");
                              alert(selected);

                          });

解决方案

('#aspnetForm');


("input,select", parentsa).mouseover(function () { var selected =


("input,select", parentsa).options


这篇关于如何获取我页面中所有下拉列表的选定索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆