Is it possible to select css generated content? [duplicate]

No, you can’t. See Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery. To repeat what is described there, generated content is not part of the DOM. In the words of the CSS2.1 spec, Generated content does not alter the document tree. Generated content only exists in the visual world of the … Read more

JavaScript: Disable text selection via doubleclick

I fear you can’t prevent the selection itself being “native behavior” of the browser, but you can clear the selection right after it’s made: <script type=”text/javascript”> document.ondblclick = function(evt) { if (window.getSelection) window.getSelection().removeAllRanges(); else if (document.selection) document.selection.empty(); } </script> Edit: to also prevent selecting whole paragraph by “triple click”, here is the required code: var … Read more

window.getSelection() gives me the selected text, but I want the HTML

Take a look at the DOM Range spec. You can get a Range from the user selection in Firefox using: var range = window.getSelection().getRangeAt(0); Note that some browsers, including Firefox, allow multiple selections, which can be accessed via the getRangeAt() method of the selection. The Range is expressed in terms of DOM nodes and offsets … Read more

How to bind multiple selection of listview to viewmodel?

Like Doctor has already pointed out, you can bind SelectedItems to XAML CommandParameter After a lot of digging and googling, I have finally found a simple solution to this common issue. To make it work you must follow ALL the following rules: Following Ed Ball’s suggestion’, on you XAML command databinding, define CommandParameter property BEFORE … Read more

How To Wrap / Surround Highlighted Text With An Element

If the selection is completely contained within a single text node, you can do this using the surroundContents() method of the range you obtain from the selection. However, this is very brittle: it does not work if the selection cannot logically be surrounded in a single element (generally, if the range crosses node boundaries, although … Read more