Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Cannot read property 'substr' of undefined #9

Open
onet4 opened this issue Jun 22, 2016 · 0 comments
Open

Uncaught TypeError: Cannot read property 'substr' of undefined #9

onet4 opened this issue Jun 22, 2016 · 0 comments

Comments

@onet4
Copy link

onet4 commented Jun 22, 2016

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.

<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant