BindAsEventListener not returning Observe element in Prototype
var Generic_Large_Blue = new Element('div', { 'id': 'divZoltarSubmit_', 'class': 'Generic_Large_Blue Blue_' + placeholder });
var Generic_Large_Blue_Left = new Element('div', { 'class': 'Gene开发者_StackOverflow社区ric_Large_Blue_Left' });
var Generic_Large_Blue_Middle = new Element('div', { 'class': 'Generic_Large_Blue_Middle' });
var Generic_Large_Blue_Span = new Element('span').update("Submit");
var Generic_Large_Blue_Right = new Element('div', { 'class': 'Generic_Large_Blue_Right' });
//event on submit Click
Event.observe(Generic_Large_Blue, 'click', function(event) {
moZoltarCurrent.evt_ZoltarOnSubmit.bindAsEventListener(this,Item_TextArea, PriceInBox,event);
});
//this function is called when the submit button is clicked
evt_ZoltarOnSubmit: function(e) {
var sourceElement = Event.element(e);
var args = $A(arguments);
}
I have Click event on Generic_Large_Blue
but Source Element Returned as Generic_Large_Blue_Left
,Generic_Large_Blue_Middle
, Generic_Large_Blue_Right
.
Depeding on Click postion Its not returning Observe Element
Please help me out
Look closely at the example for bindAsEventListener
on its documentation page. bindAsEventListener
returns function, doesn't call function. Here is good code:
Event.observe(Generic_Large_Blue, 'click', moZoltarCurrent.evt_ZoltarOnSubmit.bindAsEventListener(this, Item_TextArea, PriceInBox));
PS: Next time check if your code is displayed correctly (you didn't specify what blocks are the code, so formatting fell apart).
精彩评论