简体   繁体   中英

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. I can also not click the button.

Here is the 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:

$('#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/

Seems to work just fine as long as you reference JQuery and JQuery UI properly:

 $('#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. 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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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