Search results
Top results related to how to highlight text on chromebook
Top Answer
Answered Feb 20, 2013 · 2 votes
You should be able to do it by modifying style.backgroundColor of the link(s):
window.parent.frames["frame2"].document.getElementById(id).style.backgroundColor = "yellow";-
1/5
Top Answer
Answered May 23, 2017 · 2 votes
You need to combine these answers with a mouseenter event:
function selectElementText(el, win) { el.focus(); win = win || window; var doc = win.document, sel, range; if (win.getSelection && doc.createRange) { sel = win.getSelection(); range = doc.createRange(); range.selectNodeContents(el); sel.removeAllRanges(); sel.addRange(range); } else if (doc.body.createTextRange) { range = doc.body.createTextRange(); range.moveToElementText(el); range.select(); }}window.onload = function() { var element = document.getElementById('TheElementToHighlight'); element.onmouseover = function(e) { e = e || window.event; var target = e.target || e.srcElement; selectElementText(target); };};
You could use jQuery events with the selectElementText function, but I would not use the jQuery version of selectElementText from the other response because it uses browser sniffing rather than feature detection.
Other Answers
Answered Jul 10, 2012 · 1 votes
This may or may not be relevant:
CSS:
::-moz-selection{ background: #B2263A; color:#fff; text-shadow: none; }-::selection { background:#B2263A; color:#fff; text-shadow: none; } -
This will change your highlight colour.
Other Answers
Answered Mar 15, 2010 · 0 votes
For IE, I think you still can use
window.clipboardData.setData('text',text);-
(check for the window.clipboardData property - and possibly even the typeof window.clipboardDatasetData - before use).
As for FF, there used to be a hack involving flash that could used as a workaround, but as of Flash 10, that road is closed too. Here's a link to an example of the flash-thing, and some people whose frustration seems to vary with their version of Flash:
http://www.logiclabz.com/javascript/copy-to-clipboard-with-javascript-on-mozilla-firefox-and-ie.aspx
2/5
Top Answer
Answered Feb 17, 2022 · 1 votes
This appears to be possible with Google Chrome if the accessibility option "Navigate pages with a text cursor" is enabled—also known as "caret browsing". Here is a Google Chrome help article about it: "Use a text cursor to navigate & select text".
The article states that this setting can be toggled by pressing F7, or by opening the "Customize and control Google Chrome" menu, opening "Settings", navigating to the "Advanced" tab, then selecting "Accessibility".
This mode allows you to use the arrow keys to move the text cursor around the page, similar to if you were editing a block of text. Text can be visually highlighted by navigating to the start of the text you want to highlight, holding the Shift key, and then arrowing to the end of the text.
I'm not sure how well this will work in conjunction with NVDA though.
3/5
Top Answer
Answered Feb 23, 2021 · 4 votes
You could reach by checking in the onchange event, the div text length and wrap extra text by a span and set inner html of that div again by concatenatin text (without extra chars) + wrapped extra text span;
(its not recommended to use innerHTML due to xss injection but it's only solution I've found to this problem )
that main problem here is once setting div innerHTML , your cursor will rest to start of div text , so i've done a little trick to set selection at the end of the text using
// get textt par before extra text let start = html.slice(0, MAX_LENGTH ) ; // get extra text let overflow = html.slice(MAX_LENGTH) ; // rap extra text by span overflow = `<span style="color:${COLOR}">${overflow}</span>`; //set text as innerHTML (or use dangerouslyINerHTML with sate var) ref.current.innerHTML = start+overflow // below part is to set cursor , at the end after inner html // because innerHTML will reset selection to the start of div text let range = document.createRange() var sel = window.getSelection() range.setStart(ref.current.lastChild, 1 ) sel.removeAllRanges() sel.addRange(range)
See here working snnipet with deiferent props example created a component and use different props
const { useRef } = React;/* create Eitable Component */const EditAbleDiv =( props ) => { // get max length from props const MAX_LENGTH = props.maxLength || 40; // get color from props const COLOR = props.warningColor || 'orange'; let ref = useRef(null); // on change event const contentChange = (e) => { // get only text without html tags let html = e.target.innerText; if (html.length > MAX_LENGTH) { // get textt par before extra text let start = html.slice(0, MAX_LENGTH ) ; // get extra text let overflow = html.slice(MAX_LENGTH) ; // rap extra text by span overflow = `<span style="color:${COLOR}">${overflow}</span>`; //set text as innerHTML (or use dangerouslyINerHTML with sate var) ref.current.innerHTML = start+overflow // below part is to set cursor , at the end after inner html // because innerHTML will reset selection to the start of div text let range = document.createRange() var sel = window.getSelection() range.setStart(ref.current.lastChild, 1 ) sel.removeAllRanges() sel.addRange(range) } } return <div ref={ref} contentEditable onInput={contentChange} > Edit text</div>}/* end component */function App() { return ( <div> <b> click in below div to edit text </b> <br/><br/> <EditAbleDiv maxLength={25} /> <hr /> <EditAbleDiv maxLength={18} warningColor={"red"} /> <hr /> <EditAbleDiv maxLength={12} warningColor={"green"} /> </div> )}ReactDOM.render( <App />, document.body);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.4/umd/react.production.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.4/umd/react-dom.production.min.js"></script>
4/5
One common feature in many applications is the ability to highlight specific portions of text based on user input. In this article, we will explore how to implement text highlighting functionality using React.js.
The following approach covers how to highlight text input given by users in ReactJS. It is a simple effect you can add to any ReactJS website.
Prerequisite:
- NPM & Node.js
- React JS styled-components
- useState() React hooks
- onChange() event
Steps to Create React Application:
Step 1: Initialize new react project using this command in the terminal
npx create-react-app react-highlight-text
Step 2: Move to the project directory.
cd react-highlight-text
Step 3: Install the dependencies required in this project by typing the given command in the terminal:
npm i --save styled-components
Project Structure:
<img>
The updated dependencies in package.json file will look like.
"dependencies": { "@testing-library/jest-dom": "^5.17.0", "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "react": "^18.2.0", "react-dom": "^18.2.0", "react-scripts": "5.0.1", "styled-components": "^6.1.1"...
5/5
stackoverflow.com › questions › 78719492Is it possible to find and read highlighted text in a pdf ...
stackoverflow.com › questions › 787194928 hours ago · Some lines in it are highlighted with a pdf editor. I would like to parse this document and extract the highlighted lines. How can this be done using c++? I found several C++ libraries that have many features for parsing and modifying PDF files, but I did not see what I needed. Thanks in advance. c++.
uk.moyens.net › buying-guide › galaxy-ring-designGalaxy Ring: design, price, release date, features ...
uk.moyens.net › buying-guide › galaxy-ring-design8 hours ago · For the South Korean manufacturer, it also means unlocking a new market; smartwatches, which Apple dominates, are reaching saturation. The Galaxy Ring aims to convince those who haven’t fallen in love with a watch before to finally jump in. Few major players in the industry currently have established themselves in this niche, and Samsung is looking to establish its brand there.
Searches related to how to highlight text on chromebook