It seems this plugin cannot modify normal html text.
When you select words in the following example, you get an error, Uncaught TypeError: Cannot read property 'substr' of undefined.
<html>
<head>
<meta charset="UTF-8">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
<script type="text/javascript" src="src/jquery.selection.js"></script>
</head>
<body>
<div class="content">
<p id="laten-text">Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts.</p>
</div>
<script>
$( document ).ready( function() {
$( '.content p' ).click(function(){
$( this )
.selection('insert', {text: '<strong>', mode: 'before'})
.selection('insert', {text: '</strong>', mode: 'after'});
});
});
</script>
</body>
</html>
Hi, looks like a nice plugin.
It seems this plugin cannot modify normal html text.
When you select words in the following example, you get an error,
Uncaught TypeError: Cannot read property 'substr' of undefined
.