0

这是我的问题。

我将一个选择标签(动态)放入一个 jQuery 弹出窗口中,该弹出窗口在除我的三星 Galaxy S1 之外的所有平台浏览器上都可以正常工作,无论浏览器是什么。选择不会下拉。如果我尝试在不使用 jQuery 的情况下将其设置为本机,问题仍然存在。

在弹出窗口之外添加此选择标签将在我的 SGS 1 上正常工作。我的代码可能有什么问题?

这是所涉及的代码示例:

HTML

        <div data-role="popup" id="popABS" data-theme="c">
            <div data-role="header" data-theme="b">
                <h1></h1>
            </div>
            <a href="#" data-rel="back" data-role="button" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Fermer</a>
            <div data-role="content">
                <div data-role="collapsible-set" data-content-theme="b">
                    <div id="detABS" data-role="collapsible" data-theme="b" data-icon="arrow" data-content-theme="b">
                        <h2>Détail des absences</h2>
                        <table id="table-ABS" class="ui-responsive table-stroke" data-role="table" data-mode="reflow">
                            <thead>
                                <tr>
                                    <th>&nbsp;</th>
                                    <th>Code</th>
                                    <th>Libellé</th>
                                    <th>Début</th>
                                    <th>Fin</th>
                                    <th>Niveau</th>
                                </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                    <div id="ajABS" data-role="collapsible" data-theme="b" data-content-theme="b" style="display:none;">
                        <h2>Demande d'absence</h2>
                        <fieldset id="jouh" data-role="controlgroup" data-mini="true" data-type="horizontal">
                            <input type="radio" name="typabs" id="typabs-j" value="J" checked="checked" />
                            <label for="typabs-j">Jour</label>

                            <input type="radio" name="typabs" id="typabs-h" value="H"  />
                            <label for="typabs-h">Heures</label>
                        </fieldset>
                        <div id="demJ">
                            <fieldset class="ui-grid-c" style="width:450px;">
                                <div class="ui-block-a labels" style="width:50px;">
                                    <label for="deb" data-inline="true">Du :</label>
                                </div>
                                <div class="ui-block-b" style="width:100px;">
                                    <input type="text" name="deb" id="deb" value="" maxlength="10" data-inline="true" data-mini="true">
                                    <input type="hidden" id="altdeb" value="">
                                </div>
                                <div class="ui-block-c" style="width:40px;">
                                    <div class="ui-icon-nodisc">
                                        <a id="caldeb" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-iconshadow="false" data-inline="true"></a>
                                    </div>
                                </div>
                                <div class="ui-block-d" style="width:200px;">
                                    <fieldset data-role="controlgroup" data-mini="true" data-type="horizontal">
                                        <input type="radio" name="ajpdeb" id="ajpdeb-j" value="2" checked="checked" />
                                        <label for="ajpdeb-j">Jour</label>

                                        <input type="radio" name="ajpdeb" id="ajpdeb-a" value="1"  />
                                        <label for="ajpdeb-a">Matin</label>

                                        <input type="radio" name="ajpdeb" id="ajpdeb-p" value="3"  />
                                        <label for="ajpdeb-p">Soir</label>
                                    </fieldset>
                                </div>
                                <div class="ui-block-a labels" style="width:50px;">
                                    <label for="deb">Au :</label>
                                </div>
                                <div class="ui-block-b" style="width:100px;">
                                    <input type="text" name="fin" id="fin" value="" maxlength="10" data-inline="true" data-mini="true">
                                    <input type="hidden" id="altfin" value="">
                                </div>
                                <div class="ui-block-c" style="width:40px;">
                                    <div class="ui-icon-nodisc">
                                        <a id="calfin" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-iconshadow="false" data-inline="true"></a>
                                    </div>
                                </div>
                                <div class="ui-block-d" style="width:200px;">
                                    <fieldset data-role="controlgroup" data-mini="true" data-type="horizontal">
                                        <input type="radio" name="ajpfin" id="ajpfin-j" value="2" checked="checked" />
                                        <label for="ajpfin-j">Jour</label>

                                        <input type="radio" name="ajpfin" id="ajpfin-a" value="1"  />
                                        <label for="ajpfin-a">Matin</label>

                                        <input type="radio" name="ajpfin" id="ajpfin-p" value="3"  />
                                        <label for="ajpfin-p">Soir</label>
                                    </fieldset>
                                </div>
                            </fieldset>
                        </div>
                        <div id="demH" style="display:none;">
                            <fieldset class="ui-grid-c" style="width:450px;">
                                <div class="ui-block-a labels" style="width:50px;">
                                    <label for="date" data-inline="true">Date :</label>
                                </div>
                                <div class="ui-block-b" style="width:100px;">
                                    <input type="text" name="date" id="date" value="" maxlength="10" data-inline="true" data-mini="true">
                                    <input type="hidden" id="altdate" value="">
                                </div>
                                <div class="ui-block-c" style="width:40px;">
                                    <div class="ui-icon-nodisc">
                                        <a id="caldate" data-role="button" data-icon="grid" data-iconpos="notext" data-theme="b" data-iconshadow="false" data-inline="true"></a>
                                    </div>
                                </div>
                                <div class="ui-block-d labels" style="width:100px;">
                                    <label for="hdeb" data-inline="true">Heure début :</label>
                                </div>
                                <div class="ui-block-e" style="width:90px;">
                                    <input type="time" name="hdeb" id="hdeb" value="" maxlength="5" placeholder="HH:MM" data-inline="true" data-mini="true">
                                </div>
                                <div class="ui-block-a labels" style="width:50px;">
                                </div>
                                <div class="ui-block-b" style="width:100px;">
                                </div>
                                <div class="ui-block-c" style="width:40px;">
                                </div>
                                <div class="ui-block-d labels" style="width:100px;">
                                    <label for="hfin" data-inline="true">Heure fin :</label>
                                </div>
                                <div class="ui-block-e" style="width:90px;">
                                    <input type="time" name="hfin" id="hfin" value="" maxlength="5" placeholder="HH:MM" data-inline="true" data-mini="true">
                                </div>
                            </fieldset>
                        </div>
                        <fieldset class="ui-grid-b" style="width:450px;">
                            <div class="ui-block-a" style="width:100px;">
                                <a href="#" id="rechabs" data-role="button" style="width:80px" data-icon="search" data-mini="true" title="Rechercher les motifs d'absences">Motifs</a>
                            </div>
                            <div id="divmotabs" class="ui-block-b" style="width:350px;">
                            **<-- Here the SELECT is added dynamically -->**
                            </div>
                        </fieldset>
                    </div>
                </div>
            </div>
        </div>

Java脚本

        var $tab = '<select id="motabs" data-mini="true" data-native-menu="true">';
        for (var $i in motAbs) {
            if (profil['ABS'] != undefined && profil['ABS'] != null && canDo(profil['ABS'].lst.split(';').join(','),motAbs[$i].code))
                $tab+= '<option value="'+motAbs[$i].code+'">'+motAbs[$i].code + " " + motAbs[$i].lib + " (" + motAbs[$i].val +')</option>';
        }
        $tab+= '</select>';
        $('#divmotabs').empty();
        $('#divmotabs').append($tab);
        $('#motabs').selectmenu();
4

1 回答 1

0

我知道这是一个很老的帖子,但万一问题仍然存在。

附加“$tab”之后

你应该写, $('#motabs').trigger('create').selectmenu();

我认为这应该有效

于 2013-10-25T23:59:57.160 回答