Is it possible to run to functions at the same time when using onchange?

Now i have this one:

<select name="hovedside_id" onchange="hentPosition(this.value)">

Using ajax i get updated another dropdown list with db info from this function just above.

I return the data to a span tag with an id.

But i need to update the page in two places when a change has happened in the drop down list.

So i can not get the additional info i need when a change has happened to the dropdown list with the onchange="hentPosition(this.value)" function, because i need to display the other information in another place in the form. If i use the same span tag id, i would get "double infomation", in both tags right?

Does it wotk to put two functions after each other??

<select name="hovedside_id" onchange="hentPosition(this.value), updateUrl(this.value)">

And then open another ajax reguest and get the info i need from the DB, using the 2nd function, and different files to get it with??

Hope someone have an advise on how i can achieve this :-)

If I havent explained very well, ill be happy to try once again!


Recommended Answers

All 2 Replies

Member Avatar

BY THE WAY - wrong forum - you need JS

If you want this:

onchange="hentPosition(this.value), updateUrl(this.value)"

do this:

onchange="hentPosition(this.value); updateUrl(this.value)"

However, we try to avoid using inline code like this - it's usually tidier to place event handlers to run functions (in script tags in head or external files).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.