Support » Plugin: Contact Form 7 » Set dropdown value to default not by query but e.g. JS

  • Hi

    I have a contact form with a “subject” dropdown. How can i set e.g. item 3 to default for a specific page – so not by query and not by form settings itself but by Javascript

    Any suggestions?

Viewing 1 replies (of 1 total)
  • hi @avwscad,

    you can try with:
    document.getElementById('subject').value = 'myval';

    (assuming “subject” is also the id of the select and “myval” is the select “default” value)

    to check if current url contains a string (eg. the page name of the contact form you want to change):

    if ( document.URL.includes("my-contact-form") ) {
       ...magic here...
    • This reply was modified 2 months, 3 weeks ago by Erik.
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.