javascript - jQuery select on div content -


I am creating a small text editor, and for this, I would like the same effect when a user selects some text here Will:

I was thinking about using the jQuery selection event, but I can not seem to work on the same divs on the input field itself.

  & lt ;! - - & lt; Input type = "text" class = "writing area" value = "foo bar" & gt; - & gt; & Lt; Div class = "writing area" & gt; Foo bar & lt; / Div & gt; & Lt; Script & gt; $ ("Writing area"). Select (function () {warning ("text marked!");}); & Lt; / Script & gt;   

You can see a demo here: Sophisticated HTML works just fine, but the DV version does not.

What am I doing wrong? Select can not be used on Divs?

For the MDN reference, say that the HTML5 device only selects the defined input and the event for the software.

Comments

Popular posts from this blog

Delphi: missing interface declarations for UI Automation methods -

php - how to change mysql_result($res, 0, "url"); to mysqli -

android - How to attach an image from an app to gmail -