Link to home
Start Free TrialLog in
Avatar of Alex Lord
Alex Lord

asked on

Changing the selected value of a select input with jq

<select required="" class="form-control input-md" name="act_lnk" id="act_lnk">
<option selected="selected" value="0">( Contact) - Level </option><option value="702279 ">( Lead ) -  testing open status</option>
<option value="702266 ">( Lead ) -  alex test dealtime</option>
<option value="702251 ">( Deal ) -  test</option>
</select>

Open in new window


here my select input,

is their a way in jq to change it selected prop?
Avatar of Nikoloz Khelashvili
Nikoloz Khelashvili
Flag of Georgia image

$("#act_lnk").val('702251');
Avatar of Sam Jacobs
Minor typo ... should be: $("#act_lnk").val('702251');
Thanks Sam, you are right, I missed letter 'a' when copying id of the select element
ASKER CERTIFIED SOLUTION
Avatar of Zakaria Acharki
Zakaria Acharki
Flag of Morocco image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial