Closed Thread Icon

Topic awaiting preservation: Firing DOM Events Pages that link to <a href="https://ozoneasylum.com/backlink?for=26073" title="Pages that link to Topic awaiting preservation: Firing DOM Events" rel="nofollow" >Topic awaiting preservation: Firing DOM Events\

 
Author Thread
WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-20-2005 18:27

I have a calendar widget that is spawned when a link is clicked. When you can then select a date from this widget and it then updates the value of an input text field.

The problem is that the value for the input is changed but the onchange event is not fired. Is there a way that I can fire the onchange event? Such as a command that would make it seem like the value had simply been changed? The reason I need this is that I have an onchange event sitting in the input, and need this to be fired whenever this value is changed.

Next part. The widget is 3rd party. I have a work around in place now that is an ugly hack. It checks if there is an onchange event set, checks if my javascript is the attribute text, and the calls the function directly.

code:
if (inputobj.hasAttribute("onchange") && inputobj.getAttribute("onchange") == "valueChanged(this)"){
		valueChanged(inputobj);
	}



The way I am doing it is specific to my app so if there is a change to the widget I have to merge my changes back in, everytime there is an update.

I would like to add a generic method of calling the onchage so that it might be put into the 3rd party app, so that it will stick around threw different versions.

Any ideas?

Dan @ Code Town

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 06-20-2005 18:49

To answer my own question.

I can put this into the function that changes the value.

code:
if (inputobj.hasAttribute("onchange")){
		inputobj.onchange();
	}



Dan @ Code Town

« BackwardsOnwards »

Show Forum Drop Down Menu