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 9023343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:44:19+00:00 2026-06-16T05:44:19+00:00

This currently returns undefined. What should go in the commented line to alert the

  • 0

This currently returns undefined. What should go in the commented line to alert the value (1, 2, 3 or 4) of the current <option> tag?

<select id="dropdown" name="dropdown">
        <option value="0" data-imagesrc="images/icons/all.png">All Questions</option>
        <option value="1" id="friends" data-imagesrc="images/icons/friends.png">Friends</option>
        <option value="2" data-imagesrc="images/icons/friends_of_friends.png">Friends of Friends</option>
        <option value="3" data-imagesrc="images/icons/network.png"><?php echo $network; ?></option>
        <option value="4" data-imagesrc="images/icons/location.png"><?php echo $location ?></option>
</select>

<script type="text/javascript">
$('#dropdown').ddslick({
showSelectedHTML: false,
    onSelected: function(selectedData){
    var str = $(this).attr('id'); // WHAT SHOULD GO HERE?
    alert(str);
    }   
});
</script>

EDIT

If it’s relevant, I’m using this plugin.

Perhaps this question might help. I’m trying to make sense of it.

Managed to figure this out. Final working code is:

<select id="dropdown" name="dropdown" value="hello">
        <option value="0" data-imagesrc="images/icons/all.png">All Questions</option>
        <option value="1" id="friends" data-imagesrc="images/icons/friends.png">Friends</option>
        <option value="2" data-imagesrc="images/icons/friends_of_friends.png">Friends of Friends</option>
        <option value="3" data-imagesrc="images/icons/network.png"><?php echo $network; ?></option>
        <option value="4" data-imagesrc="images/icons/location.png"><?php echo $location ?></option>
</select>

<script type="text/javascript">
$('#dropdown').ddslick({
    showSelectedHTML: false,
    onSelected: function(data){
        alert(data.selectedData.value);
    }   
});
</script>
  • 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-06-16T05:44:21+00:00Added an answer on June 16, 2026 at 5:44 am

    According to the docs for your plugin, the onSelected method gets the selectedData parameter:

    selectedData (nested object with text, value, description, imageSrc)

    The text label and value are available as selectedData.text and selectedData.value inside the onSelected function. Try this:

    $('#dropdown').ddslick({
        showSelectedHTML: false,
        onSelected: function(selectedData){
            var str = selectedData.value
            alert(str);
        }   
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

document.getElementsByName('name').value returns undefined . I don't have the foggiest idea as to why this
I'm executing a fetch request that returns about 2000 entities. Currently, this takes about
This is very similar to another recent question: How can I return the current
I have this following code which will return all the current semesters. How do
<script> $(document).ready(function() { $('a.panel').click(function () { $('a.panel').removeClass('selected'); $(this).addClass('selected'); current = $(this); $('#slidewrapper').scrollTo($(this).attr('href'), 300); return
I am doing this currently, class Page { // variable to hold DBC class
I have something like this currently: <div class = className style = position: absolute;
this is currently my code byte[] bytes = { 0x42, 0x1c, 00, 00 };
This is currently my htacess file: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond
This program currently inputs an image of a coin, thresholds it, binarizes it, and

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.