This is a discussion on Multiple Div Selection within the AJAX Ideas forums, part of the General category; 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 ...
|
|||||||
|
|
#1 (permalink) |
|
Junior Member
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 |
|
|
|
| Sponsored Links | |
|
|
#2 (permalink) |
|
Junior Member
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. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| multiple divs, multiple layers, text formating on divs |
|
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multiple XML responses in IE | NBFruit | AJAX Help | 1 | 08-08-2007 06:47 PM |
| Real-World AJAX Book Preview: Row Selection in the SimpleTable | microbee | AJAX Help | 0 | 04-24-2007 07:02 PM |