Return to Snippet

Revision: 55773
at February 22, 2012 04:24 by LadyLoomis


Initial Code
var pId = "<? echo $_GET['category'] ?>";
$("select#category option[name=" + pId + "]").prop("selected", true);

Initial URL

                                

Initial Description
Set a variable by getting the URLs id with PHP.  Find the the option with the name value that is equal with the variable and add "selected" to it.

Initial Title
PHP/ Jquery Dropdown Select

Initial Tags
php, dropdown, jquery

Initial Language
jQuery