CopyPastor

Detecting plagiarism made easy.

Score: 0.8299137949943542; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2016-09-21
by jaspreet Kaur

Original Post

Original - Posted on 2013-02-14
by Ian



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Just Change Minor syntax and you can make your code executable
<a href="www.mysite.com" onclick="return theFunction();">Item</a> <script type="text/javascript"> function theFunction () { // return true or false, depending on whether you want to allow the `href` property to follow through or not } </script>
The default behavior of the `<a>` tag's `onclick` and `href` properties is to execute the `onclick`, then follow the `href` as long as the `onclick` doesn't return false, canceling the event (or the event hasn't been prevented)
You already have what you need, with a minor syntax change:
<a href="www.mysite.com" onclick="return theFunction();">Item</a>
<script type="text/javascript"> function theFunction () { // return true or false, depending on whether you want to allow the `href` property to follow through or not } </script>
The default behavior of the `<a>` tag's `onclick` and `href` properties is to execute the `onclick`, then follow the `href` as long as the `onclick` doesn't return `false`, canceling the event (or the event hasn't been prevented)

        
Present in both answers; Present only in the new answer; Present only in the old answer;