#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    147
    Rep Power
    121

    JQuery bsmSelect help


    Hi,

    I'm hoping someone can help me as I really don't know JS or JQuery much at all.

    I'm making use of this bsmSelect JQuery module:
    bsmSelect

    If you look at the Demo Page On example #4, you will see a "select all" link.
    That is what I'm using, but I'd also like to add a "remove all" link as well.

    The code looks like this:

    Code:
    $("#eessfiles1").bsmSelect({
            addItemTarget: 'bottom',
            animate: true,
            highlight: true,
            plugins: [$.bsmSelect.plugins.sortable(),$.bsmSelect.plugins.compatibility()]
    }).after($("<a href='#'>Select All</a>").click(function() {
        	$("#eessfiles1").children().attr("selected", "selected").end().change();
            return false;	
    }));
    Which works

    I tried doing this to add a remove all

    Code:
    $("#eessfiles1").bsmSelect({
            addItemTarget: 'bottom',
            animate: true,
            highlight: true,
            plugins: [$.bsmSelect.plugins.sortable(),$.bsmSelect.plugins.compatibility()]
    }).after($("<a href='#'>Select All</a>").click(function() {
        	$("#eessfiles1").children().attr("selected", "selected").end().change();
            return false;	
    }).after($("<a href='#'>Remove All</a>").click(function() {
        	$("#eessfiles1").children().attr("selected", "").end().change();
            return false;	
    }));
    Which didn't work.
    Any idea how I can add a "remove all" link?

    TIA!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0
    This worked for me.

    Code:
    $("#eessfiles1").bsmSelect({
            addItemTarget: 'bottom',
            animate: true,
            highlight: true,
            plugins: [$.bsmSelect.plugins.sortable(),$.bsmSelect.plugins.compatibility()]
    }).after($("<a href='#'>Select All</a>").click(function() {
        	$("#eessfiles1").children().attr("selected", "selected").end().change();
            return false;	
    }).after($("<a href='#'>Remove All</a>").click(function() {
        	$("#eessfiles1").parent().find(".bsmListItemRemove").click();
            return false;	
    }));

IMN logo majestic logo threadwatch logo seochat tools logo