简体   繁体   中英

No onClick() event for text-field (for specific sites)

Background

I'm working on a custom browser implementation based on Qt 4.8 (QtWebkit 2.0). I'm trying to pop-up a virtual keyboard whenever the user clicks on a text field

  • I have some simple JavaScript which adds a listener for a click event on any text field
  • When a click is detected, it invokes a slot through the myWebObj object as shown below.

     $("input[type=text]").click(function() { var name = $(this).attr('id'); alert("Text field " + 'id' + " clicked"); }); 

Problem

The code above works fine for most websites. For example it works for How to Enter a Blocked Website and detects all the text fields.

However, for www.google.com, a click on the search bar doesn't invoke the click function.

Meanwhile on any standard browser like Firefox or Chrome the javascript given above works perfectly.

Any help is appreciated.

i had no problem in google.com but for apple you wont get it because their script is not your normal jquery. here is their $('selector') code

function $(element) {
    if (arguments.length > 1) {
        for (var i = 0, elements = [], length = arguments.length; i < length; i++)
            elements.push($(arguments[i]));
    return elements;
    }
    if (Object.isString(element))
        element = document.getElementById(element);
        return Element.extend(element);
}

you can check well what it does, but for your case i think your $("input[type=text]").click or $("input[type=text]").on('click', function should be completely ok.

For the virtual keyboard, you can try this: https://github.com/Mottie/Keyboard/wiki

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