Jump to content

This is hard to describe, but I am going to try.

Three Selects:


Option 1
Option 2



Option 3
Option 4





Events I want to occur:

When 'select_1' changes the currently select option, I want the first option of 'select_3' to change to the id and label of the currently selected option of 'select_1'.

When 'select_2' changes the currently select option, I want the second option of 'select_3' to change to the id and label of the currently selected option of 'select_2'.

Link to comment
https://linustechtips.com/topic/8068-some-html-and-javascript-help/
Share on other sites

Link to post
Share on other sites

This will give you a push in the right direction:

$(document).ready(function() {
$('#select_1').change(function() {
alert('select_1 has changed');
});
});

You'll need jQuery, it makes all the Javascript code as small as it gets, like shown above.

That code will show an alert when you change an option.

Replace the alert with some 'document.GetElementById("select_3")' code, and you're done. :)

If you aren't familiar with the that function, read this:

http://www.w3schools.com/jsref/met_doc_getelementbyid.asp

Or this:

https://developer.mozilla.org/en-US/docs/DOM/document.getElementById

You can do lot's of stuff with it.

Welcome to Javascript. ;)

Computer Case: Define R4 | CPU: FX8350 @ 4.4Ghz (1.35v) | Cooler: NH-D14 | MoBo: Sabertooth 990FX R2.0 | RAM: Crucial Ballistix Tactical (LP) 16GB 2000mhz CL9-T1 (1.5v) | PSU: RM1000 | SSD: 120GB 840 Evo | HDD: 2TB Barracuda | GPU: GTX 760 2GB (TwinFrozr)

Peripherals Keyboard: IBM Model M (Buckling Spring) | Mouse: Logitech M570 (Trackball) | Headset: SX-910A (Bluetooth)
Phone iOcean X7 | CPU: MT6589 @ 1.2Ghz (Stock) | Screen: 5" 1080P |---| Tablet Voyo A15 | CPU: Samsung Exynos 5250 @ 2.0Ghz (OC) | Screen: 11.6" 1080P

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×