[Kss-devel] Trigger onchange event on an input programattically

Godefroid Chapelle gotcha at bubblenet.be
Wed Mar 7 14:24:33 CET 2007


Hedley Roos wrote:
> I have a case where using KSS would be overengineering.

Then why do you want half KSS hereunder ?

> 
> Basically I have on a form
> 
> <input name="foo" id="bar" class="someclass" onChange="alert('hello');">
> 
> <a onClick="document.getElementById('bar').onchange(); return false;" 
> href="#">Test</a>
> 
> and the KSS reacts to a change event for the class someclass.
> 
> Clicking Test fires the alert 'hello', but the event is not picked up by 
> azax.

This is normal :

document.getElementById('bar').onchange()

explicitely call the onchange function that you defined; it does not 
trigger the browser event.

IOW, it cannot trigger the KSS event handler that has been registered on 
the event itself

> 
> Manually changing the contents of input foo results in the alert 'hello' 
> and it is picked up by azax.
> 
> So, how do I get it to work when clicking Test?
> 
> Hedley
> _______________________________________________
> Kss-devel mailing list
> Kss-devel at codespeak.net
> http://codespeak.net/mailman/listinfo/kss-devel


-- 
Godefroid Chapelle (aka __gotcha)- BubbleNet  http://bubblenet.be



More information about the Kss-devel mailing list