+ Reply to Thread
Results 1 to 2 of 2

Thread: Multiple Div Selection

  1. #1
    testemailtusa is offline Junior Member testemailtusa is on a distinguished road
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Multiple Div Selection

    Hi,

    I need to select multiple divs and has to apply text formating properties like (font size, color, bold, italic etc.) so that text formating is applied on all selected
    divs.

    Also I want to know the way to selected multiple divs at a time using Ctrl key.

    Any script will be of great help

    Thanks in advance

  2. #2
    w.cain is offline Junior Member w.cain is on a distinguished road
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0
    if (Drupal.jsEnabled) {
    $(document).ready(function() {
    var selected = new Array();

    $('select').mouseover(function() {
    if (this.multiple == true) {
    for (var i=0,a=0;i<this.options.length;i++) {
    if (this.options[i].selected == true) {
    selected[a] = this.options[i].value;
    a++;
    }
    }
    }
    });

    // safe them when you click the mouse
    $('select').click(function() {
    // make sure it's a multiple select
    if (this.multiple == true) {
    for(var i=0;i<selected.length;i++) {
    for(var a=0;a<this.options.length;a++){
    if (selected[i] == this.options[a].value && this.options[a].selected == true) {
    this.options[a].selected = false;
    selected.splice(i,1);
    } else if (selected[i] == this.options[a].value) {
    this.options[a].selected = true;
    }
    }
    }
    }

    // load all selected options in array when the mouse pointer hovers the select box
    if (this.multiple == true) {
    for (var i=0,a=0;i<this.options.length;i++) {
    if (this.options[i].selected == true) {
    selected[a] = this.options[i].value;
    a++;
    }
    }
    }

    });
    });
    }

    If you want to add this to your drupal installation, copy paste the code into /misc/multipleselect.js, then add

    <script type="text/javascript" src="/misc/multipleselect.js"></script>

    into your page.tpl.php. If you want to use it in a non-drupal installation, just leave out the the first (if (Drupal.jsEnabled) {) and last (}) line of this snippet.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. Multiple XML responses in IE
    By NBFruit in forum AJAX Help
    Replies: 1
    Last Post: 08-08-2007, 06:47 PM
  2. Replies: 0
    Last Post: 04-24-2007, 07:02 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts