This project has moved. For the latest updates, please go here.

Pre-fill dropdown list entry

Mar 6, 2013 at 2:51 PM
Hello, VERY new to SPServices but have successfully managed to pre-fill the title field (excellent!). I was just wondering if the same could be achieved for dropdown menus? I would like to pre-select the dropdown item.

Title code:
$("input[Title='Title']").val("Hello World"); Works perfectly

I took a similar approach to the drop down:

Thanks in advance for any help/advice.
Mar 7, 2013 at 9:02 AM
Ok, it was obviously close to going home time yesterday as I've just realised my question had nothing to do with SPServices! Just simple jQuery. After some more research I simply needed to add a : to the front of input:

Not sure why, but this worked.
Mar 7, 2013 at 2:38 PM
That actually won't work. Dropdowns in SharePoint are either simple select elements (fewer than 20 options) or a complex comination of an input element, a select element, and some script to drive it.

So, as long as you have fewer than 20 options, the right jQuery is:
where n is the ID of the value you want.