WordPress.org

Ready to get started?Download WordPress

Forums

Register Plus Redux
How to create a default choice for the dropdown Select Field? (3 posts)

  1. WPChina
    Member
    Posted 3 years ago #

    I'm glad I found this plugin! Is there a way to have one of the choices in my "Select Field" the default choice?

    For example, if I have "apple,banana,candy,donut,eggplant,french fry,grape,hamburger" in my dropdown alphabetically, but I want the "grape" choice to the be default choice that users first see. Is there a code or notation I can use to make sure that appears on the dropdown menu for that Select Field?

    Tks~~

    http://wordpress.org/extend/plugins/register-plus-redux/

  2. radiok
    Member
    Plugin Author

    Posted 3 years ago #

    Unfortunately there is not a way to set up a default choice for select fields. That is a great request. In the meantime, you could write some jQuery to accomplish pretty much the same thing. Whenever the page loads to change the value of a certain field, be that food, you would jQuery("#food").val("grape"); or something like that.

  3. WPChina
    Member
    Posted 3 years ago #

    Excellent workaround and thanks for your quick help! It would be great to see a non-jQuery addition to the script in the future, but this is what I added now and it works very well:

    <script type="text/javascript">
    jQuery(document).ready(function() {
    jQuery("#food").val("grape");
    });
    </script>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic