Answers.Body: <p>You need to trigger the change() event of the field (after the event handler is attached so not on page load but on <code>$(document).ready(</code>)</p>
  
  <pre><code>$("#entryType").val(5).change();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-12T20:43:19.180Z
Answers.LastActivityDate: 2017-12-12T21:30:29.043Z
Answers.LastEditDate: 2017-12-12T21:30:29.043Z
Answers.UserDisplayName: Robin Schambach
Body: <p>At the moment I'm trying to create a script that is supposed to be run (by chrome extension) on page load (of the new entry page) that with automatically set the entry type. The name of the entry type is "Episodes" and the value (from the html) of the entry type is 5.</p>
  
  <p>Here's the script I have so far.</p>
  
  <pre><code>var contenttype = document.getElementById('entryType');
  contenttype.value = "5";
  </code></pre>
  
  <p>When run, this changes the Entry Type field on the side, but it doesn't actually set the entry type.</p>
  
  <p>How should I go about doing this?</p>
  
Tags: <entry><admin><entry-type><javascript>
Title: Programmatically Setting Entry Type Via Javascript
ThreadText: # Programmatically Setting Entry Type Via Javascript
  
  (Asked by: username_0 on 2017-12-12)
  
  At the moment I'm trying to create a script that is supposed to be run (by chrome extension) on page load (of the new entry page) that with automatically set the entry type. The name of the entry type is "Episodes" and the value (from the html) of the entry type is 5.
  
  Here's the script I have so far.
  
  ```
  var contenttype = document.getElementById('entryType');
  contenttype.value = "5";
  
  ```
  
  When run, this changes the Entry Type field on the side, but it doesn't actually set the entry type.
  
  How should I go about doing this?
  
  **Tags:** entry, admin, entry-type, javascript
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-12-12. Score: 1
  
  You need to trigger the change() event of the field (after the event handler is attached so not on page load but on `$(document).ready(`)
  
  ```
  $("#entryType").val(5).change();
  
  ```
  
  
  ---
  
  