Clear Select options when selecting one field while using multiple forms on same page

Posted by Nizam on Stack Overflow See other posts from Stack Overflow or by Nizam
Published on 2010-03-22T11:13:16Z Indexed on 2010/03/22 11:21 UTC
Read the original article Hit count: 273

Filed under:
|
|

Hi all,

I have a situation where the second select list option is generated from the first select list selected option. Like when we select Country corresponding states are generated in next select list.

In my case I am having multiple forms on single page which are same. Can anyone let me know how to implement it on multiple forms.

I tried the following code but it didn't work

        $(".country").change(function(){
       $.get("sample.php?val=" + $(this).val(),
        function(data){
            $(this).parent().next().children('.state').children('option').remove();
            $(this).parent().next().children('.state').append(data);
        });

Waiting for your support thanks in advance

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about forms