簡體   English   中英

文本區域包含內容並打開鍵盤時,按鈕單擊不起作用

[英]Button click not working when text area has content and keyboard is opened

我不知道如何正確地問這個問題。 我已經搜索了很多,但是對正在發生的事情一無所知。

我在帶有文本區域和輸入按鈕的響應頁面中有一個HTML表單。 當textarea包含文本並且如果我單擊按鈕打開鍵盤時,在Chrome Mobile中打開頁面,則不會觸發click事件。 我必須隱藏鍵盤,然后單擊按鈕。 這樣行就可以了。

我迷路了,因為HTML / CSS / JavaScript不是我的強項...

這是一些代碼:

<footer id="footer">
            <div class="inner">

                <h3>Get in touch</h3>

                <form action="#" method="post">

                    <div class="field half first">
                        <label for="name">Name</label>
                        <input name="name" id="name" type="text" placeholder="Name">
                    </div>
                    <div class="field half">
                        <label for="email">Email</label>
                        <input name="email" id="email" type="email" placeholder="Email">
                    </div>
                    <div class="field">
                        <label for="message">Message</label>
                        <textarea name="message" id="message" rows="6" placeholder="Message"></textarea>
                    </div>
                    <ul class="actions">
                        <li><input id="send" value="Send Message" class="button alt" type="button"></li>
                    </ul>
                </form>                 

            </div>
        </footer>

這是Javascript部分,非常簡單:

$("#send").on("click", function (e) {
    console.log(new Date());
});

附:jQuery處理按鈕單擊。

試試這個:

 $("#send").on("click touchstart", function (e) {
     console.log(new Date());
 });        

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM