Posted By

LadyLoomis on 02/22/12


get menu select php dropdown option jquery name variable Value

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


PHP/ Jquery Dropdown Select

 / Published in: jQuery

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.

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

Report this snippet  

You need to login to post a comment.