Re: jquery fill select option value

From: Date: Sun, 22 Sep 2013 13:12:42 +0000
Subject: Re: jquery fill select option value
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-322143@lists.php.net to get a copy of this message
On 9/22/2013 3:52 AM, Ashley Sheridan wrote:
iccsi <inungh@gmail.com> wrote:
<select id="mark" name="mark"> <option value="">--</option> <option value="bmw">BMW</option> <option value="audi">Audi</option> </select> I use above code to have my select drop down on the form and would like to use jQuery to fill option value on change event. I would like know is it possible to do, if yes, any hint or example code at server site is appreciated, Your help and information is great appreciated, Regards, Iccsi,
Yes it is possible but a) not at server side because JavaScript is run on the browser, and b) this is a PHP list not a JavaScript list. Saying that, why aren't you populating it on the server side with PHP? Thanks, Ash Not sure what you are asking. With PHP it is possible to have a specifi item from the options selected in the drop down when the page is loaded. With JS it is possible to capture the newly selected option value and place it in another field, if that is what you want. Obviously when the user clicks on an option, that value IS placed in the select tag for processing at the server side by PHP on submit.
So what is it you want to accomplish?

« previous php.general (#322143) next »