JavaScript to set default value on SharePoint form field

I found the below script, placed it in but no change...  is there any obvious issue?

<script src=””</script>
<script type=”text/javascript”>

$(document).ready(function() {

$(“select[Title=’PursuitType’]”).val(‘CLIN 6AG’);


Matt PinkstonEnterprise ArchitectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
Works for me - so either you don't have a select with that title or there is some error on your page.

1. Check your console for errors (F12)
2. Check that you have a select with Title PursuitType

This sample demonstrates the code works

Aside: why are you using a title as a selector? Surely the <select> has at least a name or an id - which would be more logical?
Matt PinkstonEnterprise ArchitectAuthor Commented:
Thanks for the reply

<SharePoint:FormField runat="server" id="ff2x{$Pos}" ControlMode="New" FieldName="PursuitType" __designer:bind="{ddwrt:DataBind('i',concat('ff2x',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@PursuitType')}" />

When I try to add title= it says that is not valid
Julian HansenCommented:
Ok but I ask again why are you trying to reference the select by title?

Why not ID or Class?
Ensure Business Longevity with As-A-Service

Using the as-a-service approach for your business model allows you to grow your revenue stream with new practice areas, without forcing you to part ways with existing clients just because they don’t fit the mold of your new service offerings.

Matt PinkstonEnterprise ArchitectAuthor Commented:
the JavaScript I found asks for title????

$(“select[Title=’PursuitType’]”).val(‘CLIN 6AG’);
Julian HansenCommented:
the JavaScript I found asks for title????
The code you posted has an ID so you can use an id

$("#ff2x{$Pos}").val('CLIN 6AG'); 

Open in new window

If there is only one select on the page then

$("select").val('CLIN 6AG'); 

Open in new window

Failing that post the rendered HTML for the page and let's see what SharePoint spits out.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Matt PinkstonEnterprise ArchitectAuthor Commented:
Julian HansenCommented:
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.