javascript - Observing 'click' event on <a> tag generated by scriptaculous Builder -
I am using a screwdriver builder to dynamically generate some DOM elements, and one of these links The tag is. I was not sure how this builds with other builder code with clickback inline, so I'm generating a link tag ahead of time and then to put it in the rest builder step.
The problem is that the callback for the link is never actually executed when I click the link, and the URL bar changes in turn, the callback method is a part of my class, Therefore, I am compelling it as an event listener ahead of time.
var Foo = Class.create ({initialize: function () {this Closebinding = this.doClose.bindAsEventListener (this);}, generate: function () {/ * create link and Click listener * / var close_link = Builder.node ('a', {href: '#'}, 'off'); event.blog, 'click', this.close binding) / * generate new dom nodes / / Builder Build.node ('div', [Builder.node ('h2', 'this is a test'), close_link])}}, doClose: function (evt) {/ * when I click on the link it The code is never called. *}});
So, I discovered the real problem, I actually got something about this incident Was not doing too wrong, but I left the incident which was not relevant but apparently relevant. I'm creating the DOM code being inserted in a model box [1], and apparently because the script is interfering with my event binding or something else because it was seeing a function on the link 'this' It was confused because apparently 'this' was referring to the Modlobox, and not my object Foo.
So my solution was a little less than ideal, but I found another way to reach 'data' in this "', and therefore the binding incident is no longer in my way.
[1]
Comments
Post a Comment