I'm facing this error: JavaScript runtime error: Unable to get property 'querySelector' of undefined or null reference
Im trying to make a contact pick on Cordova. This works good on iOS and Android. On windows phone, the apps runs but then crashes with this error. Here is where it crashes (var listeningElement). I searched a lot but can't get a solution. Anyone could help me to fix it? thanks:
receivedEvent: function(id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
listeningElement.setAttribute('style', 'display:none;');
receivedElement.setAttribute('style', 'display:block;');
console.log('Received Event: ' + id);
}
After much research the solution that resolved my issue was this: Strange phonegap device ready event behaviour
that is put this line back in your index.html
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
good luck