is it possible to throw the jquery-select() event on a text which is inside a div element?
here is my example but it doesnt work.
<div id='id1'>Hello text</div>
$("#id1").select( function () {
alert("something was selected");
});
My goal is to select a word in a text and to put this selected word in an URL and to open a new window with this url.
For example i mark or rather i select the word hello, the word hello should apear in this url
window.open('http://dict.leo.org/ende?lp=ende&lang=de&searchLoc=0&cmpType=relaxed§Hdr=on&spellToler=&search=Hello');
i am not sure if the select-event is the right way.
please help.
sorry for my bad english!
Translate a selected (highlighted) text portion
jsBin demo
NB:
notIE8means lower than or equal to IE8 😉P.S: If you don’t use jQuery and you need to support older browsers, than make sure to use
onclickfunction and a Polyfill for.trim();otherwise use JS’s
addEventListener()andString.prototype.trim()as usual.