vendredi 2 janvier 2015

phonegap inappbrowser check checkbox is checked

I am trying to check checkbox's event in webview on Phonegap. I want to handle the events of checkbox, but unfortunately, my code is wrong. When I insert my code in 'if' function. It isn't working. I am not sure that if my code is right of Inappbrowser syntax or not. Here is my code:



<!DOCTYPE html>
<html>
<head>
<title>InAppBrowser.executeScript Example</title>

<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">

// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);

// Global InAppBrowser reference
var iabRef = null;
// Inject our custom JavaScript into the InAppBrowser window
//
function checkCheckboxEvent(event) {
if (event.url == "http://ift.tt/14jdiP4") {
iabRef.executeScript({
code: "var input=document.querySelector('#mailSettingContainer input');
if (input.checked==true) {
alert('true');
} else {
alert('false');
}"}, function() {
alert("okie!!!");
});
}
}
// device APIs are available
//
function onDeviceReady() {
iabRef = window.open('https://bitcoinget.jp/', '_blank', 'location=no');
iabRef.addEventListener('loadstop', checkCheckboxEvent);
}

</script>
</head>
<body>
</body>




Aucun commentaire:

Enregistrer un commentaire