selection

Converting Range or DocumentFragment to string

我只是一个虾纸丫 提交于 2019-12-03 10:51:11
Is there a way to get the html string of a JavaScript Range Object in W3C compliant browsers? For example, let us say the user selects the following: Hello <b>World</b> It is possible to get "Hello World" as a string using the Range.toString() method. (In Firefox, it is also possible using the document 's getSelection method.) But I can't seem to find a way to get the inner HTML. After some searching, I've found that the range can be converted to a DocumentFragment Object. But DocumentFragments have no innerHTML property (at least in Firefox; have not tried Webkit or Opera). Which seems odd to

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

一个人想着一个人 提交于 2019-12-03 09:25:13
This question already has answers here : How can I make generated content selectable? (2 answers) Let's say I have mark up: <div data-generated="world!">Hello </div> ..with CSS: div:after { content: attr(data-generated); } This produces the text: Hello world! - FIDDLE div:after { content: attr(data-generated); } <div data-generated="world!">Hello </div> BUT... If I try to select / Copy the text - only the 'hello ' part is selectable. Is there any way to select css generated text? NB: 1) I have looked at the spec ( here and here ) regarding generated content and I haven't seen any reference to

Select random string from given list

╄→гoц情女王★ 提交于 2019-12-03 08:57:21
I am trying to make Java select 1 random string from a given list. Example of the list of strings: 1153 3494 9509 2 0 0 0 0 1153 3487 9509 2 0 0 0 0 1153 3491 9525 2 0 0 0 0 1153 3464 9513 2 0 0 0 0 Each row is 1 string The idea is that it selects one, waits a certain period (like 7200 seconds) and replaces the previous string with another random string from the list (could be the same). The loop is sort of infinite. Does anyone knows how to do this? Ps. I am pretty much noobie with java :S, so i am afraid just saying i should use an arraylist (for example) wont work :P public static void main

How to navigate between instances of selected text in Sublime Text 3?

浪子不回头ぞ 提交于 2019-12-03 08:53:58
问题 Sublime Text 3 highlights all instances of currently selected text. Is there any shortcut to navigate cursor to the next / previous instance (copy) of selected text? So far, I've only managed to find out some information about adding more instances to current selection (expanding it) with Ctrl + D , skipping current instance ( Ctrl + K , Ctrl + D ) and deselecting it ( Ctrl + U ), which actually is a soft undo, not a real command. I can use Ctrl + D to go to next instance of selected text and

Making Selection & Adding tag dynamically in JavaScript

巧了我就是萌 提交于 2019-12-03 06:25:51
问题 I need some help about JavaScript on iPhone UIWebView ; I have HTML like below: <html> <head> <title>Example</title> </head> <body> <span>this example for selection <b>from</b> UIWebView</span> </body> </html> I want to make a selection, and add <span> tag with color to the selected text in HTML to write a note just like an e-book reader. This is my JavaScript code to get the selected text: NSString *SelectedString = [NSString stringWithFormat:@"function getSelText()" "{" "var txt = '';" " if

UITableView Multiple Checkmark Selection

自闭症网瘾萝莉.ら 提交于 2019-12-03 05:54:49
问题 Having read a couple of the questions asked relating to this, I can get the functionality to work. However my list is long and scrollable, so when I scroll up and down the selection of the checkmarks are all over the place. selectedIndexes is a NSMutableArray . Any ideas? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath]; if ([selectedCell accessoryType] ==

Use Javascript to get selected text in Mobile Safari

走远了吗. 提交于 2019-12-03 05:43:24
So I'm working on a bookmarklet where it would be ideal for me to grab the content selected by the user using the "loop". Both window.getSelection and document.getSelection are functions that I can call, however, they always return an empty string. I believe the problem is that when you tap on the bookmark icon in Mobile Safari, the selection is released. For example, if you select some text, tap the "+", bookmark or other tab, the selection is unselected even if you cancel. Any thoughts on if it is possible to get at this data at all? Or is this pretty much impossible? I think you would have

How to select an ListView item after long click?

谁说我不能喝 提交于 2019-12-03 05:10:07
问题 I've got a silly little problem. I've registered a ListFragment both as OnItemClickListener and OnItemLongClickListener of its own ListView . When the onItemClick event is called, an intent for the detail view activity of that item is started, no problems there. When the onItemLongClick event happens, I want to accomplish the following things: Create a CAB Keep the long-pressed item selected Code: @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id

How to bind multiple selection of listview to viewmodel?

早过忘川 提交于 2019-12-03 04:57:51
问题 I am implementing a listview, and a button next to it. I have to be able that when i select multiple items in a listview, and then click on a button, then the selected items are put into a list. But my question is , how do i bind the selected items towards the viewmodel? I changed my selectionmode to multiple. But then, do i just have to do: SelectedItem={Binding path= selectedItems} and then make in my viewmodel a property selectedItems, and it will set these items i have selected? Or what

javascript, get list of all values in select box

纵然是瞬间 提交于 2019-12-03 04:33:13
I am stumped. I have a form with a dropdown list, and I would like to grab a list of all the values in the list. I pulled the below example from w3 schools (yes, I know it's unreliable, but other solutions on stack overflow seem to be very similar to this). It was not working for me, and I tried plugging it into jsfiddle, but no luck. HTML: <form>Select your favorite fruit: <select id="mySelect"> <option value="a">Apple</option> <option value="o">Orange</option> <option value="p">Pineapple</option> <option value="b">Banana</option> </select> </form> <button type="button" onclick="displayResult