[jQuery] problem with object and attachevent
hi,
in the code below: how do I get the function showText
to see the object button bb?
all I get in the alert is "undef"
please help :(:(:(:(:(
<html>
<head>
<script lnguage="javascript">
function startHere() {
var mt = new ttt();
document.body.appendChild(mt._contentDiv);
}
function ttt() {
this.name='myTest';
this.bb = document.createElement('button');
this.bb.innerText = 'Click Me';
this.bb.attachEvent('onclick', this.showText);
this._contentDiv = document.createElement("div");
this._contentDiv.appendChild(this.bb);
}
ttt.prototype.showText = function() {
alert(this.bb);
}
</script>
</head>
<body onload="startHere()">
test
</body>
</html>