如何使用jquery比较两个下拉列表值 [英] How to compare two dropdownlist values using jquery

查看:73
本文介绍了如何使用jquery比较两个下拉列表值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友们,我要求一个下拉列表值是最低经验1到20,第二个下拉列表是最大经验1到25.如何使用jquery验证两个下拉列表值。如果我选择第二个drowdownlist值减去我想要的第一个下拉列表值,使用jquery获取验证。以及如果我们选择第二个下拉列表不为空并且第一个下拉列表为空,那么获取验证消息和其他验证也可用于该下拉列表。

Hi friends , i have requirement on one dropdownlist values is minimum experience 1 to 20 and second dropdownlist is maximum experience 1 to 25. how to validates the two dropdownlist values using jquery. if i select the second drowdownlist values less the first dropdownlist values i want get the validition using jquery. as well as if we select the second dropdownlist is not empty and first dropdownlist is empty then getting the validation message and other validations also working on that dropdownlists.

推荐答案

让我们说你有两个下拉列表:

Lets say you have two dropdown lists:
<select id="ddlMinExp">
  <option value="0">Select Minimum Exp</option>
  <option value="1">1</option>
          ......
          .......
  <option value="20">20</option>
</select>



And,


And,

<select id="ddlMaxExp">
  <option value="0">Select Maximum Exp</option>
  <option value="1">1</option>
          ......
          .......
  <option value="25">25</option>
</select>





然后你可以通过jQuery检查值 -





Then you can check the values through jQuery as -


function (){


' #ddlMaxExp')。change( function (){
var selectedMaxValue = 数字
('#ddlMaxExp').change(function(){ var selectedMaxValue = Number(


这篇关于如何使用jquery比较两个下拉列表值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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