troubleshooting Question

jQuery assign dropdown field a value

Avatar of Michael Carrillo
Michael CarrilloFlag for United States of America asked on
ASP.NETMicrosoft SharePointjQuery
10 Comments1 Solution3239 ViewsLast Modified:
What is the correct jquery syntax to assign (or select a value) a value to a dropdown field?
I am using SharePoint Designer 2007.

SharePoint Form Dropdown field code:

<tr class="ISRStatus">
	<td width="25%" class="ms-vb">
		<b>ISR Status:</b>
	</td>
	<td width="75%" class="ms-vb">
		<SharePoint:FormField runat="server" id="fXX{$Pos}" ControlMode="New" FieldName="ISR_x0020_Status" __designer:bind="{ddwrt:DataBind('i',concat('fXX',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ISR_x0020_Status')}" />
	</td>
</tr>

Page Rendered Code:

<tr>
	<td width="25%" class="ms-vb">
		<b>ISR Status:</b>
	</td>
	<td width="75%" class="ms-vb">
	<span dir="none">
		<select name="XXX...DropDownChoice" id="XXX...._DropDownChoice"
title="ISR Status" class="ms-RadioText">

			<option selected="selected" value="ISR Created">ISR Created</option>
			<option value="Approval Review">Approval Review</option>
			....
			<option value="LOE Analysis">LOE Analysis</option>

		</select>
		<br>
	</span>Status of ISR
	</td>
</tr>

jquery assignment code:

$("tr.ISRStatus select").selected("Approval Review");
I have also tried:
$("tr.ISRStatus select").val("Approval Review");
$("tr.ISRStatus select").selected.val("Approval Review");

Neither line of jquery appears to work. The value remains defaulted to "ISR Created".

Any help is appreciated!
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros