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

  • Home
  • SEARCH
  • 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'm using the ajaxform jQuery plugin to create ajaxed HTML forms and want to
I wanted to create simple plugin using jquery. Also suggest me standard practice while
I am using the Jquery cycle plugin to create an announcements slideshow. I would
We are using a heavily modded version of the jquery lightbox plugin to create
I'm using the jQuery jCarousel plugin to create a carousel of NFL player photos.
Is it possible to create Selenium tests using the Firefox plugin that use randomly
I was using jQuery plugins to create a rounded corner for my <li> ,
I am using the listen plugin for jQuery for binding events to dynamically created
I'm writing a semi-generic form plugin using jQuery in order to speed up the
All, I created a plugin using the create plugin with a view wizard, which

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.