M
M
Minusator2018-02-26 14:37:25
JavaScript
Minusator, 2018-02-26 14:37:25

How to hide tooltip when clicking on an object inside it jquery?

Hello.
When you click on the icon, a window with emoticons (img) appears.
How can I make the tooltip hide when clicking on an image inside it?

Tooltip - .my-tooltip-contain
Image (object) - .smiles

jQuery(document).ready(function ($) {
    $('body').click(function () {
        $('.my-tooltip-contain').hide();
    });

    $(document).delegate('.my-tooltip-contain', 'click', function () {
        $(this).show();
    });

    $(document).delegate('.icon', 'click', function () {
        var IconId = $(this).attr('id');
        var uniqueId = IconId.substring(IconId.lastIndexOf('-') + 1);
        $('#smyle-' + uniqueId).toggle();
    });

    $(document).delegate('.smiles', 'click', function () {
        var uniqueId = SmileUniqueId($(this), '.container');
        var smileCode = $(this).data('emoticon-code');
        if (smileCode.length && uniqueId.length) {
            smileCode = ' :' + smileCode + ': ';
            if (uniqueId === 'quicktags') {
                $('.container textarea').insertAtCaret(smileCode);
                tinyMCE.activeEditor.execCommand('mceInsertContent', 0, smileCode);
            } else if (uniqueId === '0_0') {
                $('#form-wrapper-0_0 textarea.comment').insertAtCaret(smileCode);
            } else {
                $('form-wrapper-' + uniqueId + ' textarea.comment').insertAtCaret(smileCode);
            }
        }
    });

});


Thank you for your help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-26
@Stalker_RED

$(document).delegate('.smiles', 'click', function () {
    $('.my-tooltip-contain').hide(); // добавить строчку
    . . .
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question