单击“无线电”按钮列表框在jQuery中无法清楚



在这里我要做的是在单击"广播"按钮列表框上必须使用自动完成,但它并不清楚,但它如何按点击。.因此如何根据广播按钮并显示它。

<script>
 (function ($) {
         $.widget("custom.combobox", {
                 _create: function () {
                     this.wrapper = $("<span>")
                         .addClass("custom-combobox")
                         .insertAfter(this.element);
                     this.element.hide();
                     this._createAutocomplete();
                     this._createShowAllButton();
                 },
                 _createAutocomplete: function () {
                     var selected = this.element.children(":selected"),
                         value = selected.val() ? selected.text() : "";
                     this.input = $("<input>")
                         .appendTo(this.wrapper)
                         .val(value)
                         .attr("title", "")
                         .attr("id", "sss")
                         .addClass("custom-combobox-input ui-widget ui-widget-content ui-state-default ui-corner-left")
                         .autocomplete({
                             delay: 0,
                             minLength: 0,
                             source: $.proxy(this, "_source")
                         })
                         .tooltip({
                             tooltipClass: "ui-state-highlight"
                         });
                     this._on(this.input, {
                         autocompleteselect: function (event, ui) {
                             ui.item.option.selected = true;
                             this._trigger("select", event, {
                                 item: ui.item.option
                             });
                         },
                         autocompletechange: "_removeIfInvalid"
                     });
                 },

查看此链接

对于入门者,当您选择该单元按钮时,它实际上永远不会提醒" Maingroup"。

这意味着:

有问题
if($('input:radio[name=A]:checked').val()=="maingroup"){...}

这个问题是输入:无线电不是有效的jQuery选择器。

而是使用此:

if($('input[name=A]:checked').val()=="maingroup"){...}

(您在整个代码中进行了几次)

检查一下会发生什么。如果您仍然遇到麻烦,则意味着有更多的错误...在这种情况下保持小提琴更新。

最新更新