[jQuery] jQuery-specific selected (highlighted) text?

2008-12-02 Thread stephane_r
Hello, I'm still a beginner with jQuery (and not really fluent in JavaScript), but I begin to understand how it works. I am trying to move the following code to jQuery: var text = window.getSelection(); alert(text); It shows me the currently highlighted part of an xhtml page. Now I want to us

[jQuery] Re: First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery

2008-12-02 Thread stephane_r
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 .get

[jQuery] First steps in jQuery: trying to figure the syntax to mix standard Javascript with jQuery

2008-12-02 Thread stephane_r
Hello, Sorry if my question is not worded properly, I'm new to jQuery and still do not understand its syntax. I've read a lot of examples and it did not help me much. I've got this really simple JS function: function getActiveText(e) { var text = window.getSelection(); alert(te

[jQuery] Re: [Beginner alert] How do I output the selected part of the DOM in a web page in a JS alert()?

2008-12-01 Thread stephane_r
ricardobeat wrote: > > Hi there, > > Where in the example is the class 'third' you mentioned? > It was in my test text at various random places for the example, but I still have not figured how to post snippets without parts of it being eaten/interpreted as html by the list. Still new with t

[jQuery] Re: [Beginner alert] How do I output the selected part of the DOM in a web page in a JS alert()?

2008-11-30 Thread stephane_r
SLR wrote: > > First off, I'm also new to jQuery so I apologize if my solution is the > best way to do this. Anyways, here's what I came up with > It looks like we are not far from my goal. I tested a (slightly modified) version of your suggestion and it returns me something more satisfying th

[jQuery] [Beginner alert] How do I output the selected part of the DOM in a web page in a JS alert()?

2008-11-30 Thread stephane_r
Hello, Consider the code snippet at the end of the post. It alert()s me by returning the selected text. The problem is that window.getSelection() only returns plain text. No indication of the html tags, of the classes, nor any kind of DOM. I think that jQuery has something more complete than