Search code examples
javascriptjqueryqtip

Qtip on input focus


I want to show Qtip when input get focus. Here is my code:

<script>
    function inputQtip(){
    alert("Test");
    $('#aerobot[title]').qtip({
        position: {
            my: 'right center',
            at: 'left center',
            target: $('.aerobot'),
        },
        show: {
            when: {
                target: $('#aerobot'),
                event: 'focus',
            },
        }
    });
}
inputQtip();
</script>

And its not working. Alert popups. So function is executing. What is wrong with this qtip ? :(


Solution

  • there's nothing wrong with this code. you just forgot to wrap it in document.ready function.

    $(document).ready(function() {
        inputQtip();
    });