ok so i have this in query:

$(document).ready(function(){
	$("input#copy").click(function(){
		if ($("input#copy").is(':checked'))
		{
			// Checked, copy values
			$("input#owner_address").val($("input#subject_address").val());
			$("input#owner_city").val($("input#subject_city").val());
			$("input#owner_state").val($("input#subject_state"));
			$("input#owner_zip").val($("input#subject_zip").val());
		}
		else
		{
			// Clear on uncheck
			$("input#owner_address").val("");
			$("input#owner_city").val("");
			$("input#owner_state").val("");
			$("input#owner_zip").val("");
		}
	});
});

That works fine for input:text boxes but doesnt work for dropdown menus. How to i have the state dropdown to be the same for the other

thanks in advance.

Recommended Answers

All 8 Replies

check this once:

$("input#owner_dropdownname.option:selected").val($("input#subject_dropdownname.option:selected").val());

check the link for reference:
http://api.jquery.com/val/

ok so i looked over the doc and i could get your code to work even when i changed the input to select. Its given that i changed the dropdownanme

even with trying the easy way of getting the value of the select

$("select#owner_state").val($("select#subject_state").val());

im pretty new to jquery

ok.good.

i ment i still couldnt get it to work still

ok sorry.
try this:

$("#owner_state :selected").val($("#subject_state :selected").val());

hmmm. im not sure why it wont copy over

ok then try this:

$("#owner_state").val($("#subject_state :selected").val());

this will work fine.

i apologize for some reason it didnt work at first. but now magically it doesn't.

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.