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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:40:52+00:00 2026-05-29T23:40:52+00:00

In the jquery below, the two custom fields (customfield_13272, customfield_13273) are select lists which

  • 0

In the jquery below, the two custom fields (customfield_13272, customfield_13273) are select lists which are only populated after the customfield_13271 select list is changed.

I’m trying to assign the selected option of the two custom fields, to be the first element in the list which is not the default “Select an item” option.

The problem, in addition to the fact that the selected option of those fields are not changing, is that when I attempt to alert the value of one of those options, it returns undefined.

Do I simply need to add a delay() function to allow the custom field options to populate or am I missing something else?

BTW, my jQuery css directive IS working fine.

<script type="text/javascript">
jQuery.noConflict()
jQuery(document).ready(function()
{
    jQuery('#customfield_13271').change(
    function()
    {
    jQuery('#customfield_13272,#customfield_13273').css('border','4px solid orange');
    jQuery('#customfield_13272 option').first().next().attr('selected','selected');
    jQuery('#customfield_13273 option').first().next().attr('selected','selected');
    alert(jQuery('#customfield_13272 option').first().next().val());//THIS RETURNS UNDEFINED
    });
});
</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-05-29T23:40:53+00:00Added an answer on May 29, 2026 at 11:40 pm

    You can use psuedo selecto :eq(index) to select the element at a specified index.

    Change this

    jQuery('#customfield_13272 option').first().next().attr('selected','selected');
    jQuery('#customfield_13273 option').first().next().attr('selected','selected');
    

    to

    jQuery('#customfield_13272 option:eq(1)').attr('selected','selected');
    jQuery('#customfield_13273 option:eq(1)').attr('selected','selected');
    

    I think just setting the selected attribute of option will not change the select element to show it as selected item. Try this instead.

    jQuery('#customfield_13272').val(jQuery('#customfield_13272 option:eq(1)').val());
    jQuery('#customfield_13273').val(jQuery('#customfield_13273 option:eq(1)').val());
    

    If you want to see which option is selected just use jQuery('#customfield_13272').val()

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

Sidebar

Related Questions

The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays
In the code below I have two jQuery selectors that seem to work correctly.
I am using Jquery autocomplet for two fields, Country and state. I want the
I created two custom JQuery UI widgets with same name but with different namespaces
I have the below jquery function $(function(){ $(select#rooms).change(function(){ $.getJSON(/admin/select.php,{id: $(this).val(), ajax: 'true'}, function(j){ var
How can I compact the jQuery Code Below? //FIRST CODE jQuery('.expand-two').click(function(){ jQuery('.content-two').slideToggle('fast'); }); jQuery('.expand-two').toggle(function()
I have two jQueryUI datepickers on my page. They're initialised as below: jQuery(#departureDate).datepicker({ beforeShow:
[updated] The 1st jQuery section below dynamically creates an a.open-popup element. But after I
two solutions below: one with pure css, the second with jQuery, allowing any kind
I have a jquery function which replaces a Link within two values with an

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.