Jump to content

Help get selected value from COMBO BOX


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
https://forums.phpfreaks.com/topic/282245-help-get-selected-value-from-combo-box/
Share on other sites

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');
        */
    }
});

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.