Welcome Guest, Not a member yet? Register   Sign In
[Solved] How to get Value
#1

(This post was last modified: 09-23-2016, 02:31 AM by googlemy.)

How to get the Value of last selected option of HTML Multi Select ListBox using jQuery,

When I select "Item 1 and Item 3" and click button "Add to Cart" system select big value "3",
How to get the value selected item like this,
Example : Select Item 1 & Item 4 and get value "2".

Thanks you....


PHP Code:
<?php
    
echo form_open('', array(
        
'method' => 'post',
        
'class' => 'sky-form',
        
'id' => 'demoform',
        
'style' => 'border:none',
    ));
?>

<select id="selectList" multiple="multiple" size="10" name="qty">
    <option value="1">Item 1</option>
    <option value="2">Item 2</option>
    <option value="3">Item 3</option>
    <option value="4">Item 4</option>
</select>

<script>
var demo1 = $('[name=qty]').bootstrapDualListbox();
$('#selectList option:selected').val();
</script>

<button type="button" class="btn add_to_cart" data-type="text"  data-pid='<?php echo $row['product_id']; ?>'>
        <i class="fa fa-shopping-cart fa-fw"></i>
        <?php echo translate('add_to_cart'); ?>
</button>

</form> 



Source :
http://www.jqueryscript.net/form/Respons...stbox.html

Old script
http://www.jqueryfaqs.com/Articles/Get-t...Query.aspx
Reply


Messages In This Thread
[Solved] How to get Value - by googlemy - 09-19-2016, 03:02 PM
RE: How to get Value - by rtenny - 09-22-2016, 08:32 AM
RE: How to get Value - by googlemy - 09-22-2016, 07:30 PM
RE: How to get Value - by Wouter60 - 09-22-2016, 10:41 PM
RE: How to get Value - by googlemy - 09-23-2016, 02:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB