August 20, 2010

Parent child combo box

Question by user395702

Hi
I want to implement child parent combo box(country state like if we select any country the state combo box should be populated according to selected country) in my form with jquery.
Please give any suggestion how to implement this
Thanks

Answer by Starx

Well, attach a function on the change event of the country combo box and fetch the html from the AJAX or similar. Then populate the child combo box.

For example

$("#parentbox").change(function() {
   var myval =$("#parentbox").val();
   // Fetch the content from database or similar
   $("#childbox").html(newhtml);
}

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!