The glue code is converting your jQuery object.
var text = $('div.selectable')[0].getSelection();
alert(text);
[0] takes the first element you selected and removes the jQuery
methods, replacing them with the usual DOM methods.
I don't know how supported .getSelection() is so this code may not
Ryura wrote:
The glue code is converting your jQuery object.
var text = $('div.selectable')[0].getSelection();
alert(text);
[0] takes the first element you selected and removes the jQuery
methods, replacing them with the usual DOM methods.
I don't know how supported .getSelection()
For:
what is enclosed in divs of the
class selectable
http://docs.jquery.com/Attributes/html
$('div.selectable').html()
or
http://docs.jquery.com/Attributes/text
$('div.selectable').text()
you may need to loop through them () if there are more than one
Actually the [0] doesn't convert anything, and it doesn't remove or replace
any methods. You could think of it that way, but here's a more accurate way
to look at it:
The jQuery object is an array of DOM elements. (It's not an actual Array
object, but it is an array-like object with [0], [1],
4 matches
Mail list logo