Click-on does not work for some elements on iOS cordova

In the iOS cord for the buttons and snap elements, the following actions are performed (only if href is installed):

$(function() {
    $('body').on('click', '.submit-question', function() 
        console.log("Test");
    });

although items are not added initially - only after a while.

But on iOS (but on Android) does not work

$(function() {
    $('body').on('click', 'h1', function() {
        console.log("Test 2");
    });

Even if the element h1 exists from the very beginning (but it will not ultimately). When $('h1').click()executed in the Safari console, it works, but clicking on it will not work.

+4
source share
1 answer

hope this snippet below works. I had the same issue and this is fixed.

$(function(){
    $(document.body).on('click tap touchstart', 'h1', function(){
        console.log("Test 2");
    })
})
+1
source

Source: https://habr.com/ru/post/1611230/


All Articles