Jump to content

Help get selected value from COMBO BOX


halben
Go to solution Solved by halben,

Recommended Posts

I have the following: 

 

The Inspected element from the combo box.

<div class="x-combo-list-inner" id="ext-1111">
    <div class="x-combo-list-item">Target</div>    
    <div class="x-combo-list-item">Partner</div> 
    <div class="x-combo-list-item">Other</div>      
    <div class="x-combo-list-item x-combo-selected">Too small</div>
</div>

I am trying to get the selected value "Partner" from it. 

 

here's my jquery:

$('.x-combo-list-item').click(function() {
    var item = $(this).data('item');
    
    var isPartner = ???
    
    if (item === (??I'm Stuck here??)) {
        alert('You have selected Partner!');
        // Fire your ajax call here
        /*
        $.post('handler.php', {data: data : {even: 'more data'}}, function(data), 'json');
        */
    }
});

I'm stuck on getting the selected value from the COMBO BOX. I did found something online that could be a solution: 

 

   var isPartner = _getText(_byId("ext-gen484").childNodes[2]);

But I'm not sure how to translate that to javascript.

 

 

Can someone please help me?

 
Link to comment
Share on other sites

  • Solution

Thanks for helping, I figured it out. 

 

Here's what I have: 

$('.x-combo-list-item').click(function() {
    var item = $(this);
    
    if (item.text() === "Partner") {
        alert('You have selected Partner!');
        
        // Fire your ajax call here
        /*
        $.post('handler.php', {data: data : {even: 'more data'}}, function(data), 'json');
        */
    }
});
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.