summaryrefslogtreecommitdiff
path: root/lib/scripts/textselection.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/scripts/textselection.js')
-rw-r--r--lib/scripts/textselection.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/scripts/textselection.js b/lib/scripts/textselection.js
index 742338785..bd80e9341 100644
--- a/lib/scripts/textselection.js
+++ b/lib/scripts/textselection.js
@@ -22,8 +22,7 @@ function selection_class(){
};
this.getText = function(){
- if(!this.obj) return '';
- return this.obj.value.substring(this.start,this.end);
+ return (!this.obj) ? '' : this.obj.value.substring(this.start,this.end);
};
}
@@ -188,7 +187,7 @@ function pasteText(selection,text,opts){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function insertTags(textAreaID, tagOpen, tagClose, sampleText){
- var txtarea = $(textAreaID);
+ var txtarea = jQuery('#' + textAreaID)[0];
var selection = getSelection(txtarea);
var text = selection.getText();
@@ -227,7 +226,7 @@ function insertTags(textAreaID, tagOpen, tagClose, sampleText){
* @author Andreas Gohr <andi@splitbrain.org>
*/
function insertAtCarret(textAreaID, text){
- var txtarea = $(textAreaID);
+ var txtarea = jQuery('#' + textAreaID)[0];
var selection = getSelection(txtarea);
pasteText(selection,text,{nosel: true});
}