简体   繁体   English

我无法将文本输入到jQuery UI手风琴中的表单中

[英]I can't input text into my form that is inside a jQuery UI accordion

Like the title says, I have a form with a single input and button inside of a jQuery UI Accordion content div and I can't type any text into it when I test it out. 就像标题说的那样,我在jQuery UI Accordion内容div中有一个带有单个输入和按钮的表单,并且在测试时无法在其中键入任何文本。 I can also not click the button. 我也不能单击按钮。

Here is the HTML: 这是HTML:

<button type="button" id="ic-open-report"><i class="fa fa-envelope"></i><p>Export Savings Report</p></buttOn>
                    <div id="ic-savings-report">
                        <h4>Export a PDF Savings Report</h4>
                            <div>
                            <form method="POST" class="savings-report">

                                        <input style="user-select: text;" type="email" id="ic-email"  placeholder="Email">
                                        <button type="submit" >Export</button>
                            </form>
                            </div>
                    </div>

Here is the jQuery: 这是jQuery:

$('#ic-savings-report').accordion({
    collapsible: true,
    active: false,
    animate: 400
});
$('#ic-savings-report').hide();

$('#ic-open-report').click(function(){
    $('#ic-savings-report').toggle(700);
    setTimeout("$( '#ic-savings-report' ).accordion( 'option', 'active', 0       );", 1000);
});

I'm not even sure why this would happen. 我什至不知道为什么会这样。 Why would I be unable to edit the input? 为什么我将无法编辑输入?

Here is a link to the actual project: http://lcstuff.000webhostapp.com/intellifrost-calculator/ 这是实际项目的链接: http : //lcstuff.000webhostapp.com/intellifrost-calculator/

Seems to work just fine as long as you reference JQuery and JQuery UI properly: 只要您正确引用JQuery和JQuery UI,似乎就可以正常工作:

 $('#ic-savings-report').accordion({ collapsible: true, active: false, animate: 400 }); $('#ic-savings-report').hide(); $('#ic-open-report').click(function () { $('#ic-savings-report').toggle(700); setTimeout("$( '#ic-savings-report' ).accordion( 'option', 'active', 0 );", 1000); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.12.0/jquery-ui.min.js"></script> <button type="button" id="ic-open-report"> <i class="fa fa-envelope"></i> <p>Export Savings Report</p> </button> <div id="ic-savings-report"> <h4>Export a PDF Savings Report</h4> <div> <form method="POST" class="savings-report"> <input style="user-select: text;" type="email" id="ic-email" placeholder="Email"> <button type="submit">Export</button> </form> </div> </div> 

I came across this problem and jquery ui was setting the font-size: 1em on this element .ui-widget input and for some reason this made the text invisible. 我遇到了这个问题,jQuery ui设置了font-size: 1em此元素.ui-widget input上的font-size: 1em ,由于某种原因,这使文本不可见。 So it gave the impression that I couldn't input any text as no text was showing when I typed. 因此,给人的感觉是我无法输入任何文字,因为键入时没有文字显示。

I just set it to the following to fix it: 我只是将其设置为以下内容以对其进行修复:

font-size: 14px;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM