<div class="selector-wrapper">
<div id="uniform-product-select-option-0" class="selector">
<span style="-moz-user-select: none;">6</span>
<select id="product-select-option-0" class="single-option-selector" data-option="option1" style="opacity: 0;">
<option value="6">6</option>
<option value="6.5">6.5</option>
<option value="7">7</option>
<option value="7.5">7.5</option>
<option value="8">8</option>
<option value="8.5">8.5</option>
<option value="9">9</option>
<option value="9.5">9.5</option>
<option value="10">10</option>
<option value="10.5">10.5</option>
<option value="11">11</option>
<option value="11.5">11.5</option>
<option value="12">12</option>
<option value="13">13</option>
</select>
</div>
</div>
<select id="product-select" name="id" style="display: none;">
<option id="variant-1404889668" value="1404889668"> 6 for $130.00 </option>
<option id="variant-1404894084" value="1404894084"> 6.5 for $130.00 </option>
<option id="variant-1404900932" value="1404900932"> 7 for $130.00 </option>
<option id="variant-1404905540" class="disabled" disabled="disabled" value="1404905540"> 7.5 — SOLD OUT </option>
<option id="variant-1369994436" class="disabled" disabled="disabled" value="1369994436"> 8 — SOLD OUT </option>
<option id="variant-1369994500" class="disabled" disabled="disabled" value="1369994500"> 8.5 — SOLD OUT </option>
<option id="variant-1369994564" class="disabled" disabled="disabled" value="1369994564"> 9 — SOLD OUT </option>
<option id="variant-1369994628" class="disabled" disabled="disabled" value="1369994628"> 9.5 — SOLD OUT </option>
<option id="variant-1369994692" class="disabled" disabled="disabled" value="1369994692"> 10 — SOLD OUT </option>
<option id="variant-1369994756" class="disabled" disabled="disabled" value="1369994756"> 10.5 — SOLD OUT </option>
<option id="variant-1369994820" class="disabled" disabled="disabled" value="1369994820"> 11 — SOLD OUT </option>
<option id="variant-1369994884" class="disabled" disabled="disabled" value="1369994884"> 11.5 — SOLD OUT </option>
<option id="variant-1369994948" class="disabled" disabled="disabled" value="1369994948"> 12 — SOLD OUT </option>
<option id="variant-1369995012" class="disabled" disabled="disabled" value="1369995012"> 13 — SOLD OUT </option>
</select>
以上是我试图解析的HTML。
当我在这里使用我的代码时:
function info(){
var array = document.getElementsByTagName("option");
for(i=0;i<array.length;i++){
var item = array[i].innerHTML;
alert(item);
}
}
我只获得&#34; display:none&#34;下的选项值。选择元素。而且我无法选择id为&#34; product-select-option-0&#34;的select元素。只有&#34;显示:无&#34;可以使用javascript定位select id。知道如何用id&#34; product-select-option-0&#34;来改变select元素的值。 网站是:http://shop.cncpts.com/products/air-max-1-woven-black-black-dark-grey
编辑: 这是HTML的其余部分,因此您不必访问该网站。 我也在使用greasemonkey。
<div id="container">
<header id="header" class="group">
<p class="linkhome">
<a class="ir" href="http://www.cncpts.com/">CONCEPTS</a>
</p>
<div id="search">
<form action="/search" method="get">
<fieldset>
<legend>Search</legend>
<label for="s">Search:</label>
<input name="q" value="" id="result-q" type="text">
<button type="submit">Search</button>
</fieldset>
</form>
<ul class="group social">
<li class="link-check-out"><a href="/cart">Cart <span>00 items</span></a></li>
<li><a href="/cart">Check Out</a></li>
</ul>
<!-- /social -->
</div>
<!-- /search -->
<nav id="nav">
<ul class="group">
<li id="nav-shop" class="active">
<a href="http://shop.cncpts.com/">Shop</a>
</li>
<li id="nav-about">
<a href="http://www.cncpts.com/about/">About</a>
</li>
<li id="nav-blog">
<a href="http://www.cncpts.com/blog/">Blog</a>
</li>
<li id="nav-on-air">
<a href="http://www.cncpts.com/on-air/">On Air</a>
</li>
<li id="nav-contact">
<a href="http://www.cncpts.com/contact/">Contact</a>
</li>
</ul>
</nav>
<!-- /nav -->
<nav id="subnav">
<ul>
<li><a href="/collections/apparel" title="">Apparel</a></li>
<li><a href="/collections/footwear" title="">Footwear</a></li>
<li><a href="/collections/accessories" title="">Accessories</a></li>
<li><a href="/collections/womens" title="">Women</a></li>
<li class="sale"><a href="/collections/zz-special-promotion/sale" title="">Special Promotion</a></li>
</ul>
</nav>
<!-- /subnav -->
</header>
<!-- /#header -->
<div id="main" class="group" role="main">
<div id="shop" class="group">
<div id="shop-content">
<script type="text/javascript">
(function(a){a.uniform={options:{selectClass:"selector",radioClass:"radio",checkboxClass:"checker",fileClass:"uploader",filenameClass:"filename",fileBtnClass:"action",fileDefaultText:"No file selected",fileBtnText:"Choose File",checkedClass:"checked",focusClass:"focus",disabledClass:"disabled",buttonClass:"button",activeClass:"active",hoverClass:"hover",useID:true,idPrefix:"uniform",resetSelector:false,autoHide:true},elements:[]};if(a.browser.msie&&a.browser.version<7){a.support.selectOpacity=false}else{a.support.selectOpacity=true}a.fn.uniform=function(k){k=a.extend(a.uniform.options,k);var d=this;if(k.resetSelector!=false){a(k.resetSelector).mouseup(function(){function l(){a.uniform.update(d)}setTimeout(l,10)})}function j(l){$el=a(l);$el.addClass($el.attr("type"));b(l)}function g(l){a(l).addClass("uniform");b(l)}function i(o){var m=a(o);var p=a("<div>"),l=a("<span>");p.addClass(k.buttonClass);if(k.useID&&m.attr("id")!=""){p.attr("id",k.idPrefix+"-"+m.attr("id"))}var n;if(m.is("a")||m.is("button")){n=m.text()}else{if(m.is(":submit")||m.is(":reset")||m.is("input[type=button]")){n=m.attr("value")}}n=n==""?m.is(":reset")?"Reset":"Submit":n;l.html(n);m.css("opacity",0);m.wrap(p);m.wrap(l);p=m.closest("div");l=m.closest("span");if(m.is(":disabled")){p.addClass(k.disabledClass)}p.bind({"mouseenter.uniform":function(){p.addClass(k.hoverClass)},"mouseleave.uniform":function(){p.removeClass(k.hoverClass);p.removeClass(k.activeClass)},"mousedown.uniform touchbegin.uniform":function(){p.addClass(k.activeClass)},"mouseup.uniform touchend.uniform":function(){p.removeClass(k.activeClass)},"click.uniform touchend.uniform":function(r){if(a(r.target).is("span")||a(r.target).is("div")){if(o[0].dispatchEvent){var q=document.createEvent("MouseEvents");q.initEvent("click",true,true);o[0].dispatchEvent(q)}else{o[0].click()}}}});o.bind({"focus.uniform":function(){p.addClass(k.focusClass)},"blur.uniform":function(){p.removeClass(k.focusClass)}});a.uniform.noSelect(p);b(o)}function e(o){var m=a(o);var p=a("<div />"),l=a("<span />");if(!m.css("display")=="none"&&k.autoHide){p.hide()}p.addClass(k.selectClass);if(k.useID&&o.attr("id")!=""){p.attr("id",k.idPrefix+"-"+o.attr("id"))}var n=o.find(":selected:first");if(n.length==0){n=o.find("option:first")}l.html(n.html());o.css("opacity",0);o.wrap(p);o.before(l);p=o.parent("div");l=o.siblings("span");o.bind({"change.uniform":function(){l.text(o.find(":selected").html());p.removeClass(k.activeClass)},"focus.uniform":function(){p.addClass(k.focusClass)},"blur.uniform":function(){p.removeClass(k.focusClass);p.removeClass(k.activeClass)},"mousedown.uniform touchbegin.uniform":function(){p.addClass(k.activeClass)},"mouseup.uniform touchend.uniform":function(){p.removeClass(k.activeClass)},"click.uniform touchend.uniform":function(){p.removeClass(k.activeClass)},"mouseenter.uniform":function(){p.addClass(k.hoverClass)},"mouseleave.uniform":function(){p.removeClass(k.hoverClass);p.removeClass(k.activeClass)},"keyup.uniform":function(){l.text(o.find(":selected").html())}});if(a(o).attr("disabled")){p.addClass(k.disabledClass)}a.uniform.noSelect(l);b(o)}function f(n){var m=a(n);var o=a("<div />"),l=a("<span />");if(!m.css("display")=="none"&&k.autoHide){o.hide()}o.addClass(k.checkboxClass);if(k.useID&&n.attr("id")!=""){o.attr("id",k.idPrefix+"-"+n.attr("id"))}a(n).wrap(o);a(n).wrap(l);l=n.parent();o=l.parent();a(n).css("opacity",0).bind({"focus.uniform":function(){o.addClass(k.focusClass)},"blur.uniform":function(){o.removeClass(k.focusClass)},"click.uniform touchend.uniform":function(){if(!a(n).attr("checked")){l.removeClass(k.checkedClass)}else{l.addClass(k.checkedClass)}},"mousedown.uniform touchbegin.uniform":function(){o.addClass(k.activeClass)},"mouseup.uniform touchend.uniform":function(){o.removeClass(k.activeClass)},"mouseenter.uniform":function(){o.addClass(k.hoverClass)},"mouseleave.uniform":function(){o.removeClass(k.hoverClass);o.removeClass(k.activeClass)}});if(a(n).attr("checked")){l.addClass(k.checkedClass)}if(a(n).attr("disabled")){o.addClass(k.disabledClass)}b(n)}function c(n){var m=a(n);var o=a("<div />"),l=a("<span />");if(!m.css("display")=="none"&&k.autoHide){o.hide()}o.addClass(k.radioClass);if(k.useID&&n.attr("id")!=""){o.attr("id",k.idPrefix+"-"+n.attr("id"))}a(n).wrap(o);a(n).wrap(l);l=n.parent();o=l.parent();a(n).css("opacity",0).bind({"focus.uniform":function(){o.addClass(k.focusClass)},"blur.uniform":function(){o.removeClass(k.focusClass)},"click.uniform touchend.uniform":function(){if(!a(n).attr("checked")){l.removeClass(k.checkedClass)}else{var p=k.radioClass.split(" ")[0];a("."+p+" span."+k.checkedClass+":has([name='"+a(n).attr("name")+"'])").removeClass(k.checkedClass);l.addClass(k.checkedClass)}},"mousedown.uniform touchend.uniform":function(){if(!a(n).is(":disabled")){o.addClass(k.activeClass)}},"mouseup.uniform touchbegin.uniform":function(){o.removeClass(k.activeClass)},"mouseenter.uniform touchend.uniform":function(){o.addClass(k.hoverClass)},"mouseleave.uniform":function(){o.removeClass(k.hoverClass);o.removeClass(k.activeClass)}});if(a(n).attr("checked")){l.addClass(k.checkedClass)}if(a(n).attr("disabled")){o.addClass(k.disabledClass)}b(n)}function h(q){var o=a(q);var r=a("<div />"),p=a("<span>"+k.fileDefaultText+"</span>"),m=a("<span>"+k.fileBtnText+"</span>");if(!o.css("display")=="none"&&k.autoHide){r.hide()}r.addClass(k.fileClass);p.addClass(k.filenameClass);m.addClass(k.fileBtnClass);if(k.useID&&o.attr("id")!=""){r.attr("id",k.idPrefix+"-"+o.attr("id"))}o.wrap(r);o.after(m);o.after(p);r=o.closest("div");p=o.siblings("."+k.filenameClass);m=o.siblings("."+k.fileBtnClass);if(!o.attr("size")){var l=r.width();o.attr("size",l/10)}var n=function(){var s=o.val();if(s===""){s=k.fileDefaultText}else{s=s.split(/[\/\\]+/);s=s[(s.length-1)]}p.text(s)};n();o.css("opacity",0).bind({"focus.uniform":function(){r.addClass(k.focusClass)},"blur.uniform":function(){r.removeClass(k.focusClass)},"mousedown.uniform":function(){if(!a(q).is(":disabled")){r.addClass(k.activeClass)}},"mouseup.uniform":function(){r.removeClass(k.activeClass)},"mouseenter.uniform":function(){r.addClass(k.hoverClass)},"mouseleave.uniform":function(){r.removeClass(k.hoverClass);r.removeClass(k.activeClass)}});if(a.browser.msie){o.bind("click.uniform.ie7",function(){setTimeout(n,0)})}else{o.bind("change.uniform",n)}if(o.attr("disabled")){r.addClass(k.disabledClass)}a.uniform.noSelect(p);a.uniform.noSelect(m);b(q)}a.uniform.restore=function(l){if(l==undefined){l=a(a.uniform.elements)}a(l).each(function(){if(a(this).is(":checkbox")){a(this).unwrap().unwrap()}else{if(a(this).is("select")){a(this).siblings("span").remove();a(this).unwrap()}else{if(a(this).is(":radio")){a(this).unwrap().unwrap()}else{if(a(this).is(":file")){a(this).siblings("span").remove();a(this).unwrap()}else{if(a(this).is("button, :submit, :reset, a, input[type='button']")){a(this).unwrap().unwrap()}}}}}a(this).unbind(".uniform");a(this).css("opacity","1");var m=a.inArray(a(l),a.uniform.elements);a.uniform.elements.splice(m,1)})};function b(l){l=a(l).get();if(l.length>1){a.each(l,function(m,n){a.uniform.elements.push(n)})}else{a.uniform.elements.push(l)}}a.uniform.noSelect=function(l){function m(){return false}a(l).each(function(){this.onselectstart=this.ondragstart=m;a(this).mousedown(m).css({MozUserSelect:"none"})})};a.uniform.update=function(l){if(l==undefined){l=a(a.uniform.elements)}l=a(l);l.each(function(){var n=a(this);if(n.is("select")){var m=n.siblings("span");var p=n.parent("div");p.removeClass(k.hoverClass+" "+k.focusClass+" "+k.activeClass);m.html(n.find(":selected").html());if(n.is(":disabled")){p.addClass(k.disabledClass)}else{p.removeClass(k.disabledClass)}}else{if(n.is(":checkbox")){var m=n.closest("span");var p=n.closest("div");p.removeClass(k.hoverClass+" "+k.focusClass+" "+k.activeClass);m.removeClass(k.checkedClass);if(n.is(":checked")){m.addClass(k.checkedClass)}if(n.is(":disabled")){p.addClass(k.disabledClass)}else{p.removeClass(k.disabledClass)}}else{if(n.is(":radio")){var m=n.closest("span");var p=n.closest("div");p.removeClass(k.hoverClass+" "+k.focusClass+" "+k.activeClass);m.removeClass(k.checkedClass);if(n.is(":checked")){m.addClass(k.checkedClass)}if(n.is(":disabled")){p.addClass(k.disabledClass)}else{p.removeClass(k.disabledClass)}}else{if(n.is(":file")){var p=n.parent("div");var o=n.siblings(k.filenameClass);btnTag=n.siblings(k.fileBtnClass);p.removeClass(k.hoverClass+" "+k.focusClass+" "+k.activeClass);o.text(n.val());if(n.is(":disabled")){p.addClass(k.disabledClass)}else{p.removeClass(k.disabledClass)}}else{if(n.is(":submit")||n.is(":reset")||n.is("button")||n.is("a")||l.is("input[type=button]")){var p=n.closest("div");p.removeClass(k.hoverClass+" "+k.focusClass+" "+k.activeClass);if(n.is(":disabled")){p.addClass(k.disabledClass)}else{p.removeClass(k.disabledClass)}}}}}}})};return this.each(function(){if(a.support.selectOpacity){var l=a(this);if(l.is("select")){if(l.attr("multiple")!=true){if(l.attr("size")==undefined||l.attr("size")<=1){e(l)}}}else{if(l.is(":checkbox")){f(l)}else{if(l.is(":radio")){c(l)}else{if(l.is(":file")){h(l)}else{if(l.is(":text, :password, input[type='email']")){j(l)}else{if(l.is("textarea")){g(l)}else{if(l.is("a")||l.is(":submit")||l.is(":reset")||l.is("button")||l.is("input[type=button]")){i(l)}}}}}}}}})}})(jQuery);
</script>
<div class="product-images">
<ul class="product-image-display">
<li class="active">
<a class="product-showcase thickbox" rel="set_product_images" href="//cdn.shopify.com/s/files/1/0076/1662/products/shopify_nike-air-max-1-woven_00c_zoom_1024x1024.jpg?v=1430159412">
<img src="//cdn.shopify.com/s/files/1/0076/1662/products/shopify_nike-air-max-1-woven_00c_zoom_large.jpg?v=1430159412 }}" alt="" "="" height="300" width="300">
<img class="lightbox-trigger" src="https://cdn.shopify.com/s/files/1/0076/1662/t/1/assets/lightbox-trigger.gif?25633" alt="View Fullsize">
</a>
</li>
<li style="display: none;" class="">
<a class="product-showcase thickbox" rel="set_product_images" href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom2_1024x1024.jpg?v=1430159412">
<img src="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom2_large.jpg?v=1430159412 }}" alt="" "="" height="300" width="300">
<img class="lightbox-trigger" src="https://cdn.shopify.com/s/files/1/0076/1662/t/1/assets/lightbox-trigger.gif?25633" alt="View Fullsize">
</a>
</li>
<li style="display: none;" class="">
<a class="product-showcase thickbox" rel="set_product_images" href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom3_1024x1024.jpg?v=1430159412">
<img src="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom3_large.jpg?v=1430159412 }}" alt="" "="" height="300" width="300">
<img class="lightbox-trigger" src="https://cdn.shopify.com/s/files/1/0076/1662/t/1/assets/lightbox-trigger.gif?25633" alt="View Fullsize">
</a>
</li>
<li style="display: none;" class="">
<a class="product-showcase thickbox" rel="set_product_images" href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom4_1024x1024.jpg?v=1430159412">
<img src="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom4_large.jpg?v=1430159412 }}" alt="" "="" height="300" width="300">
<img class="lightbox-trigger" src="https://cdn.shopify.com/s/files/1/0076/1662/t/1/assets/lightbox-trigger.gif?25633" alt="View Fullsize">
</a>
</li>
<li style="display: none;" class="">
<a class="product-showcase thickbox" rel="set_product_images" href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom5_1024x1024.jpg?v=1430159412">
<img src="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom5_large.jpg?v=1430159412 }}" alt="" "="" height="300" width="300">
<img class="lightbox-trigger" src="https://cdn.shopify.com/s/files/1/0076/1662/t/1/assets/lightbox-trigger.gif?25633" alt="View Fullsize">
</a>
</li>
</ul>
<ul class="branded slideshow-nav group">
<li class="active">
<a href="//cdn.shopify.com/s/files/1/0076/1662/products/shopify_nike-air-max-1-woven_00c_zoom_large.jpg?v=1430159412">
01
</a>
</li>
<li>
<a href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom2_large.jpg?v=1430159412">
02
</a>
</li>
<li>
<a href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom3_large.jpg?v=1430159412">
03
</a>
</li>
<li>
<a href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom4_large.jpg?v=1430159412">
04
</a>
</li>
<li>
<a href="//cdn.shopify.com/s/files/1/0076/1662/products/nike-air-max-1-woven_00c_zoom5_large.jpg?v=1430159412">
05
</a>
</li>
</ul>
</div>
<div class="product-details group">
<div class="product-info entry">
<h2 id="product-title">Air Max 1 Woven (Black/Black-Dark Grey)</h2>
<div class="price">
<span id="price-field">$130.00 USD</span>
</div>
<div id="product-description">
Air Max 1 Woven (Black/Black-Dark Grey)
</div>
<div class="share">
<p>Share:</p>
<ul class="bonus-info">
<li><a href="http://www.facebook.com/share.php?u=http://shop.cncpts.com/products/air-max-1-woven-black-black-dark-grey&t=Air Max 1 Woven (Black/Black-Dark Grey)">Facebook</a></li>
<li><a href="http://twitter.com/home?status=Air Max 1 Woven (Black/Black-Dark Grey) - http://shop.cncpts.com/products/air-max-1-woven-black-black-dark-grey">Twitter</a></li>
</ul>
</div>
</div>
<div class="product-purchase">
<div class="product-form">
<form action="/cart/add" method="post">
<div id="product-variants">
<div class="selector-wrapper"><div id="uniform-product-select-option-0" class="selector"><span style="-moz-user-select: none;">6</span><select style="opacity: 0;" id="product-select-option-0" data-option="option1" class="single-option-selector"><option value="6">6</option><option value="6.5">6.5</option><option value="7">7</option><option value="7.5">7.5</option><option value="8">8</option><option value="8.5">8.5</option><option value="9">9</option><option value="9.5">9.5</option><option value="10">10</option><option value="10.5">10.5</option><option value="11">11</option><option value="11.5">11.5</option><option value="12">12</option><option value="13">13</option></select></div></div><select style="display: none;" id="product-select" name="id">
<option value="1404889668" id="variant-1404889668">
6 for $130.00
</option>
<option value="1404894084" id="variant-1404894084">
6.5 for $130.00
</option>
<option value="1404900932" id="variant-1404900932">
7 for $130.00
</option>
<option value="1404905540" id="variant-1404905540" disabled="disabled" class="disabled">
7.5 — SOLD OUT
</option>
<option value="1369994436" id="variant-1369994436" disabled="disabled" class="disabled">
8 — SOLD OUT
</option>
<option value="1369994500" id="variant-1369994500" disabled="disabled" class="disabled">
8.5 — SOLD OUT
</option>
<option value="1369994564" id="variant-1369994564" disabled="disabled" class="disabled">
9 — SOLD OUT
</option>
<option value="1369994628" id="variant-1369994628" disabled="disabled" class="disabled">
9.5 — SOLD OUT
</option>
<option value="1369994692" id="variant-1369994692" disabled="disabled" class="disabled">
10 — SOLD OUT
</option>
<option value="1369994756" id="variant-1369994756" disabled="disabled" class="disabled">
10.5 — SOLD OUT
</option>
<option value="1369994820" id="variant-1369994820" disabled="disabled" class="disabled">
11 — SOLD OUT
</option>
<option value="1369994884" id="variant-1369994884" disabled="disabled" class="disabled">
11.5 — SOLD OUT
</option>
<option value="1369994948" id="variant-1369994948" disabled="disabled" class="disabled">
12 — SOLD OUT
</option>
<option value="1369995012" id="variant-1369995012" disabled="disabled" class="disabled">
13 — SOLD OUT
</option>
</select>
<div class="selector-wrapper">
<div id="uniform-undefined" class="selector"><span style="-moz-user-select: none;">1</span><select style="opacity: 0;" name="quantity">
<option value="1">Quantity</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select></div>
</div>
</div>
<p class="cart-button">
<button style="background: none repeat scroll 0% 0% rgb(144, 54, 28);" type="submit" name="add" value="add" id="add-to-cart">Add to Cart</button>
</p>
</form>
</div>
<p class="cart-button"><a href="http://shop.cncpts.com">Keep Browsing</a></p>
<p class="cart-button"><a href="/collections/vendors?q=Nike">Shop more Nike</a></p>
</div>
</div>
答案 0 :(得分:1)
我假设你在info
document.ready
,我刚刚对你的函数进行了以下更改
(function info(){
var array = document.getElementsByTagName("option");
for(i=0;i<array.length;i++){
var item = array[i].innerHTML;
alert(item);
}
})();
<强> Working FIDDLE 强>
<强>更新强>
但是,在通过您的指定功能获取options
时,我发现没有任何问题。检查 THIS FIDDLE