html Lista de select o combo enlazada en javascript

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html Lista de select o combo enlazada en javascript相关的知识,希望对你有一定的参考价值。

/*! Chained 1.0.0 - MIT license - Copyright 2010-2014 Mika Tuupola */
!function(a,b){"use strict";a.fn.chained=function(c){return this.each(function(){function d(){var d=!0,g=a("option:selected",e).val();a(e).html(f.html());var h="";a(c).each(function(){var c=a("option:selected",this).val();c&&(h.length>0&&(h+=b.Zepto?"\\\\":"\\"),h+=c)});var i;i=a.isArray(c)?a(c[0]).first():a(c).first();var j=a("option:selected",i).val();a("option",e).each(function(){a(this).hasClass(h)&&a(this).val()===g?(a(this).prop("selected",!0),d=!1):a(this).hasClass(h)||a(this).hasClass(j)||""===a(this).val()||a(this).remove()}),1===a("option",e).size()&&""===a(e).val()?a(e).prop("disabled",!0):a(e).prop("disabled",!1),d&&a(e).trigger("change")}var e=this,f=a(e).clone();a(c).each(function(){a(this).bind("change",function(){d()}),a("option:selected",this).length||a("option",this).first().attr("selected","selected"),d()})})},a.fn.chainedTo=a.fn.chained,a.fn.chained.defaults={}}(window.jQuery||window.Zepto,window,document);
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  
</head>
<body>
<select id="mark" name="mark">
  <option value="">CIUDAD</option>
  <option value="mty">MONTERREY</option>
  <option value="chi">CHIHUAHUA</option>
  <option value="sal">SALTILLO</option>
</select>
<select id="series" name="series">
  <option value="">--</option>
  <option value="series-3" class="mty">HOSPITAL ALTA ESPECIALIDAD</option>
  <option value="series-5" class="mty">HOSPITAL CONCHITA</option>
  <option value="series-6" class="mty">HOSPITAL SUR</option>
  <option value="a3" class="chi">HOSPITAL DEL PARQUE</option>
  <option value="a4" class="chi">CENTRO DE ONCOLOGÍA</option>
  <option value="a5" class="sal">HOSPITAL SALTILLO</option>
</select>
<script charset="utf-8">
  $(function(){
      $("#series").chained("#mark");
  });
  </script>
  </body>
  </html>

以上是关于html Lista de select o combo enlazada en javascript的主要内容,如果未能解决你的问题,请参考以下文章

sql Canção - Tombamento por Lista de Produtos

java Métodororponsávelurquebrar uma lista em uma lista de listas de tamanho dadopelopar

markdown [WIP] Lista de leituras essenciais de TI

text Lista de iconos

java COPIA DE UNA LISTA

css 使用UL / lista de项目列出顶点