I have a large div inside there which are smaller divs, achor tags and other elements. Each large div in my program is bound to \"mousedown\" event and inside the onMouseDown ha
I tried modifying your code and there were multiple problems with the code and corrected them.
This is the JavaScript part
var src = '';
var label = document.createElement('DIV')
label.innerHTML = src;
var topdiv = document.getElementById("test");
console.log(label)
topdiv.appendChild(label);
label.addEventListener('click', test, false);
function test(event) {
if(event.target.tagName.toLowerCase() === 'a') {
var href = event.target.href;
console.log(href);
}
window.location = href;
};
This is the HTML part of it
test
I did this in a jsfiddle http://jsfiddle.net/KDejm/1/
Please let me know if the vent is captured correctly.