简体   繁体   中英

Javascript / Jquery call function

I have an application where I use InAppBrowser plugin . In function LoadStop I overwrite a button click event .

function LoadStop(event) {      
    ref.executeScript({
        code : " $('i.icon-camera').click(function(event){ ButtonClick(); });"
    });

}

function ButtonClick() {
    alert("good");
}

ButtonClick() function don't get called.

***UPDATE***

It's work:

ref.executeScript({
    code : " $('i.icon-camera').click(" + ButtonClick + ");"
});

function ButtonClick() {
    event.preventDefault();
    event.stopPropagation();
    alert("joooasd");
}

Try this one:

function LoadStop(event) {      
ref.executeScript({
    code : " $('i.icon-camera').click(function("+event+"){ ButtonClick(); });"
});

}

function ButtonClick() {
alert("good");
}

does it work?

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