0

How do i Add JQuery Reference in Office Web AddIn.

I have tried putting them in

  • Added reference in TaskPane.html
  • Added direct reference from internet in Taskpane.html
  • Tried following script in Taskpane.js

    function addJQuery() { var head = document.getElementsByTagName('head')[0]; var scriptjQuery = document.createElement('script'); scriptjQuery.type = 'text/javascript'; scriptjQuery.id = 'jQuery' scriptjQuery.src = 'https://code.jquery.com/jquery-3.4.1.min.js'; var script = document.getElementsByTagName('script')[0]; head.insertBefore(scriptjQuery, script); }

None of the above option is working. and all of them gives $ is undefined error.

3
  • Adding reference in Taskpane.html is right way for this. There might be issue with the sequence in which you are loading scripts Commented Nov 28, 2019 at 10:40
  • will it be possible for you to share some code or reference. some how its not working out for me. This is very crucial for me as i need to connect to external Service. Because it seems there is no way i can access the Project Custom Fields directly via Office.js API. Commented Nov 29, 2019 at 13:52
  • Could you share a code snippet of the Taskpane.html where you're including the scripts? That will make it easier to figure out the root cause. Here is a sample: github.com/OfficeDev/outlook-add-in-command-demo/blob/master/… Commented Dec 2, 2019 at 14:39

1 Answer 1

2

Add the following to your html :

<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js" type="text/javascript"></script>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.