Nick Nick - 29 days ago 9
Android Question

How to disable the default behavior of log press cordova android

It's

Jquery
,
html
,
css
based application using Cordova to build APK.

I have another function performing with long press on screen, it's working by clicking on the middle of two strings, to avoid default dialog. Most of the time default device long press dialog popup appears on top of the screen. How do I disable the top part showing in below screenshot? Tried some
css
and
Javascript
tricks but nothing helps.

Check screenshot here

Here is the code for long press dialog

$(document).on("mousedown touchstart","#table_discrepancy tr", function() {

var orderno = $(this).find("td:eq(0)").text();
var workorderno = $(this).find("td:eq(1)").text();

var timer = setTimeout(function() {

server('/get_customer_info/' + orderno, function(result){

var cus_name = result.name.replace(/^[\s]+/, '');
cus_name = cus_name.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
var phone_no = result.phoneno.replace(/^[\s]+/, '');
var email = result.email.replace(/^[\s]+/, '');

$('#customer_info_modal').modal('show');

$('#orderno_modal').html('Order# : ' + orderno);
$('#workorderno_modal').html('Work Order# : ' + workorderno);
$('#customer_name_modal').html('Name : ' + cus_name);
$('#customer_phoneno_modal').html('Phone#: ' + phone_no);
$('#customer_email_modal').html('Email: ' + email);
});

}, 1000);

$(this).on("mouseup touchstart", function() {
clearTimeout(timer);
});
})

Answer Source

Blocked by adding CSS with class define in body, it doesn't allow to select anything from the screen

.noselect {
   -webkit-touch-callout: none; /* iOS Safari */
   -webkit-user-select: none; /* Safari */
   -khtml-user-select: none; /* Konqueror HTML */
   -moz-user-select: none; /* Firefox */
   -ms-user-select: none; /* Internet Explorer/Edge */
    user-select: none; /* Non-prefixed version, currently
                              supported by Chrome and Opera *
     }