Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4076038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:22:28+00:00 2026-05-20T17:22:28+00:00

I am using a plugin to create a real slick jquery select (dropdown) menu.

  • 0

I am using a plugin to create a real slick jquery select (dropdown) menu.

The html requires the following format:

<select>
<option value="0" selected="selected" data-skip="1">Choose an Artist</option>
<option value="1">Title</option>
<option value="2">Title</option>
<option value="3">Title</option>
<option value="4">Title</option>
</select>

I want to use wordpress to display certain pages in a select menu:

<?php wp_dropdown_pages('child_of=96'); ?>

WordPress successfully returns a select menu of all of the correct pages. I need a jquery solution to insert this before the first select element: <option value="0" selected="selected" data-skip="1">Choose an Artist</option> and I also need jquery to assign an option value to the next select item (see markup above). So basically, I need a jquery solution to append that line before the first select item and also assign a consecutive option value (i++) to the next select item.

Thanks in advance, and I hope that makes sense.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:22:28+00:00Added an answer on May 20, 2026 at 5:22 pm

    You need to prepend your new list option to your select and then loop over the options and insert value attribute with a number that increases each time the function loops.

        $("select").prepend("<option selected='selected' data-skip='1'>Choose an Artist</option>'");
           var i = 1;
        $("select option").each(function() {
           $(this).attr("value",i);
           i++;
         });
    

    Fiddle: jsfiddle.net/67de7/1

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used the jQuery Qtip plugin to create some tooltips using the following
I'm using the plugin http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ to create tooltips with JQuery but I can't created
I'm using the jquery columnizer plugin to create columns of a text in a
I am using the jquery plugin boilerplate ( available here ) to create an
I'm trying to dynamically create alert messages using the jQuery plugin for Bootstrap CSS.
So I am using this jquery plugin to create a nice pie chart on
I am using the jQuery BBQ: Back Button & Query Library plugin to create
i am using jqtransform plugin to create select input, i make some change in
In our application we're using jdMenu plugin to create a hierarchical menu from nested
I'm using jQuery Cycle plugin to create a very simple slideshow. Below the script:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.