Andy
Andy

Reputation: 3021

onchange event from select box to update field

On this page: http://www.blackdownluxurylettings.co.uk/place_booking/2010-3-18,2

I am using an onchange event on the "number of days" select box to update the "departure date" field.

But currently nothing is happening.

Any ideas?

Upvotes: 0

Views: 891

Answers (3)

Orson
Orson

Reputation: 15451

You can bind it this way using JQuery:

$("#ddlNumberOfDays").bind('change', mainPharmacy_Change)

Maybe for javascript, you should just try 'change'.

Upvotes: 0

Todd
Todd

Reputation: 1674

Just looking at it quickly: wouldn't you want the ONCHANGE event attached to the SELECT tag rather than the individual options?

Upvotes: 1

Topher Fangio
Topher Fangio

Reputation: 20667

If I recall correctly, the regular Javascript onChange event only fires once the select box loses focus AND it's contents have been changed. I don't know how jQuery achieves it, but their change method will fire whenever the contents are updated.

Also, I get the following error in my Javascript console when loading your page:

[cycle] terminating; zero elements found by selector

Upvotes: 0

Related Questions