Hi all.

I've a form with a country text box with 2 hidden sub-textbox fields.
For example, if the user fill the country field with "United States",
will be shown him 2 text fields: City and State. On the other hand, if
he choose "Brazil", will be shown him only one text field: City.
Only the Country field has autocomplete.

It's working for manual filling: if the user focus the field, fill it
and focus-out, then the page will show the right field(s).
My problem is: I'm trying to fill the field using JS:

$('input[name=country]').val('United States');
$('input[name=state]').val('New Hampshire');
$('input[name=city]').val('Concord');

All 3 fields are being filled, but bot State and City fields only are
shown if I focus and "un-focus" the Country field.

So, how can I send a "focus and 'un-focus'" "function" to the country
field?

I mean: something like this:

$('input[name=country]').val('United States').focus().unfocus();
$('input[name=state]').val('New Hampshire');
$('input[name=city]').val('Concord');


Please, let me know if I need to clarify my question.

Thanks,

davi

Reply via email to