1

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?

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();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.