Skip to content

Instantly share code, notes, and snippets.

@lettergram
Last active Aug 29, 2015
Embed
What would you like to do?
function clickHandler(e){
var alertString, elem, evt = e ? e:event;
if (evt.srcElement) {
elem = evt.srcElement;
}else if (evt.target) {
elem = evt.target;
}
alertString = 'Tag=<'+ elem.tagName + '>';
if(elem.hasAttribute('id')) {
alertString += '\\nId=' + elem.getAttribute('id');
}
if(elem.hasAttribute('class')) {
alertString += '\\nClass=' + elem.getAttribute('class');
}
if(elem.hasAttribute('name')) {
alertString += '\\nName=' + elem.getAttribute('name');
}
// This calls the Qt application function webElement
bridgeOperations.webElement(alertString);
return true;
}
function init() {
document.onclick = clickHandler;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment