Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

Setting default value on load with Javascript not working.

$
0
0

Hello 

I have been trying to set the default values in the Survey list new Item when load, question1/Text field with querystring url. I get the url value via Javascript successfully, I can display it. however when I tried to set the default field value, it shows blank in either of the case. tried with field internal name, field display name, Textfield Id etc. All return blank when I click on New Item.

Please note that I added script editor webpart on the NewForm.aspx page.

<script src="https://code.jquery.com/jquery-1.11.0.min.js"> </script>
<script type="text/javascript">

$(document).ready(function() {

$("select[Title='FieldTitle']").val("Text");

$("select[id^='Title_fa564e0f-0c70-4ab9-b863-0177e6ddd247_$TextField']").val("Text");

});
</script>

Please help setting default text field values working in SP 2013.

Many Thanks

Shri


Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>