前言
- 在移动端同时引入了jquery和zepto,选择selected文本的时候报错。
解决方案
- 方案一,使用jquery
<script>jQuery.noConflict()</script>
var txt = jQuery("#yourId").find("option:selected").text();
- 方案二,还是使用zepto
var a = $('#yourId').find("option").not(function(){ return !this.selected }).text();
zepto issues参考
issues: selector $(‘option[selected]’) does not work #503