Trying to implement some javascript functions within the content editor. I have more advanced code to implement, but am not able to even execute the following code. The user defined function will not execute when the link is pressed.

<script type="”text/javascript”">

function Adding(a,b) {


<a href="javascript:Adding(3,4)">Click here to add two numbers</a> 

This is implemented in a Content Editor. I can implement javascript defined functions, but it will not execute a user defined function like the example above.

Any thoughts? This is on a Sharepoint 2013 Enterprise corporate intranet.

| improve this question | | | | |
  • never mind ... I found my error in the <script> ... double quotes. – user3658710 Jun 2 '15 at 17:34

Change the below code:

<a href="javascript:Adding(3,4)">Click here to add two numbers</a> 

to something like this and try:

<button onclick="javascript:Adding(3,4)">Click here to add two numbers</button> 
| improve this answer | | | | |

I found the syntax error in my code.

<script type="”text/javascript”"> should be <script type="text/javascript">

| improve this answer | | | | |
  • 3
    This is not really an answer. Please extend it to show what was wrong and how you fixed it to make your answer as helpful as possible to future readers – Robert Lindgren Jun 2 '15 at 18:07
  • I had cut and pasted code from an example into the content editor. I don't know if it was the source, or if sharepoint modified the text (funny stuff happens in content editor as it tries to interrupt javascript). <script type=""text/javascript""> Double quotes ... you can see in my original note that they are of a different format. – user3658710 Jun 2 '15 at 19:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.