1
<div id="message" class="">
        <textarea id="message_input" name="message" class="inactive" data-value="Bericht..."></textarea>
        <span class="settings"></span>
        <div id="message_send"><i class="fa fa-paper-plane-o"></i></div>
    </div>

$("#message_send").click(function(){
    //not doing anything yet
});

When I focus on the textarea, a virtual keyboard appears on mobile devices as it should. However, when "clicking" the #message_send button it should stay and not hide. How can I prevent the keyboard from hiding without having to lose the jQuery click event?

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
Mart
  • 475
  • 4
  • 21

3 Answers3

1

Try to prevent the default behaviour using e.preventDefault() :

$("#message_send").click(function(e){
    e.preventDefault();
});

Try also touchstart/touchend :

$("#message_send").on('touchstart touchend', function(e){
    e.preventDefault();
});

Hope this helps.

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
0
I find this solution http://jsfiddle.net/YQxXN/1/

I hope help you

<textarea id="txt"></textarea>
<input type="button" id="btnClick" value="Submit" />
<script>
$(document).ready(function () {
    var field = $("#txt");
    var btn = $("#btnClick");
    field.on("focusin", f1);
    field.on("focusout", f2);
    btn.on("mousedown", f3);

    function f1() {
        field.removeClass("c1").addClass("c2");
    }

    function f2() {
        field.removeClass("c2").addClass("c1");
    }

    function f3() {
        alert('hi');`enter code here`
    }

});
</script>
-1

Try this

< div id="message_send" class="">

BLABLABAL

< /div>

Augusto
  • 89
  • 6