Javascript expert needed Urgently
$10-30 USD
Paid on delivery
I need the following js script to work with safari and IE. Tested on chrome and Firefox and works well. It looks like safari is not supporting .getRangeAt(0).
The id is a contenteditable div.
----------
<div id="container contenteditable"></div>
----------.
var saveSelection, restoreSelection;
saveSelection = function(containerEl) {
var range = [login to view URL]().getRangeAt(0);
var preSelectionRange = [login to view URL]();
[login to view URL](containerEl);
[login to view URL]([login to view URL], [login to view URL]);
var start = [login to view URL]().length;
return {
start: start,
end: start + [login to view URL]().length
}
}
restoreSelection = function(containerEl, savedSel) {
var charIndex = 0, range = [login to view URL]();
[login to view URL](containerEl, 0);
[login to view URL](true);
var nodeStack = [containerEl], node, foundStart = false, stop = false;
while (!stop && (node = [login to view URL]())) {
if ([login to view URL] == 3) {
var nextCharIndex = charIndex + [login to view URL];
if (!foundStart && [login to view URL] >= charIndex && [login to view URL] <= nextCharIndex) {
[login to view URL](node, [login to view URL] - charIndex);
foundStart = true;
}
if (foundStart && [login to view URL] >= charIndex && [login to view URL] <= nextCharIndex) {
[login to view URL](node, [login to view URL] - charIndex);
stop = true;
}
charIndex = nextCharIndex;
} else {
var i = [login to view URL];
while (i--) {
[login to view URL]([login to view URL][i]);
}
}
}
var sel = [login to view URL]();
[login to view URL]();
[login to view URL](range);
}
var savedSelection;
savedSelection = saveSelection( [login to view URL]("container") );
restoreSelection([login to view URL]("container"), savedSelection);
function getselected(){
return [login to view URL]().getRangeAt(0);
}
Project ID: #19385802
About the project
Awarded to:
Hi, How are you? Greetings from Yoshida in Japan! ⭐24hours communication, if you need, I can work as full time⭐ I’ve carefully gone through your job post. I feel very confident on your project and You will get the "B More
4 freelancers are bidding on average $49 for this job
Hi, Let me help you with javascript, I have vast experience, ready to start and look forward to work with you..thanks!
will help you. I have 8+ years of experience in JavaScript. I assure you i will give 100% quality work. I am online. Let us discuss to proceed further