Hi,
I would like to understand how the getSelection function works. Therefore I want to do a little test. I want to display my selected text on a button.
My code:
<template name="seltext">
This is a test test test test
<input type="button" id="test" class="new" value="pause">
</template>
and the .js
Template.seltext.events({
'click .new': function(){
var text = "";
if (window.getSelection) {
text = window.getSelection().toString();
} else if (document.selection && document.selection.type != "Control") {
text = document.selection.createRange().text;
}
return text;
value = text;
}});
So there are two things I don’t understand. Does the getSelect function work and how do I change the displayed text on a button? I thought value= … would do it but it doesn’t. Is something like this not handled through events?
Thanks in advance