Sunday 15 August 2010

jquery - Changing selects to inputs - going back and forth -


I am going forward and going forward between a SELECT and a textbox for the state area based on the country selected SELECT For the first time on my form the closed country of the US or Canada has changed, I have the functionality, however, when the country goes back to the US or Canada, it does not return to the selection any ideas?

  $ (document) .ready (function () {$ ("# country"). ('Change', function () {var country select = $ ("# country") Val (); if (choose country == "ca"} select country == "US")) replace {// $ ("# state") ($ ("# state") .clone ((' 'Type', 'text')); $ ("# state").);});   

thanks

I just posted an answer that I 'Going to edit with the following:

The function is $ ("# country"). ("Change" .....

Do you have id = "country" with element = id = "state" element? Because if you are, this function will never be called again. / P>

And in the light of the comment of MikilaAid, I will leave my original answer, okay.

  if (choose country == "ca" || select country == "US")) {$ ("# state"). Replacewith ('& lt; input type = "text" name = "state" id = "state" />,);} other {$ ("# state"). Replace ('& lt; Select & gt; & lt; Option ... etc')}}    

No comments:

Post a Comment