w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
I change/load the content in child Select Box, depending on the parent Select Box options using html

update your parent with onchange event calling our created function updateChild() in javascript.

<select class="select_styled" name="car_model"
onchange="updateChild()">

write this function in Javascript

<script type="text/javascript">
function updateChild()
{
  document.getElementsByName('car_year').value =
document.getElementsByName('car_model').value;
}
</script>

This function just simply take value from parent and sets in child accordingly to parent's value and as we have called it onchange event so it executes on change of element.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.