Ad Code

Multiple item selection by pressing ctrl button

<select multiple class="form-control">
  <option>Amoos</option>
  <option>Jhon</option>
  <option>Ghori</option>
</select>

$(document).ready(function() {
jQuery('option').mousedown(function(e) {
    e.preventDefault();
    jQuery(this).toggleClass('selected');
 
    jQuery(this).prop('selected', !jQuery(this).prop('selected'));
    return false;
});
});

--------------------------------------------------------------------

<div class="inside">
    <div class="gradient new">New</div>
    <table>
        <tr class="subject"><td node="1">row1</td></tr>
        <tr class="subject"><td node="2">row2</td></tr>
            <tr class="subject"><td node="1">row1</td></tr>
        <tr class="subject"><td node="2">row2</td></tr>
                <tr class="subject"><td node="1">row1</td></tr>
        <tr class="subject"><td node="2">row2</td></tr>
                <tr class="subject"><td node="1">row1</td></tr>
        <tr class="subject"><td node="2">row2</td></tr>
    </table>
</div>


$(document).ready(function() {
    $(".new").click(function() {
        $('<tr />').addClass('subject').append(
        $('<td />').text('new row')).appendTo('.inside table');
    });
    $(".subject").live('mousedown', function() {
        $(this).addClass("selected");
    });
});

Post a Comment

0 Comments