0

I added jQuery to my Sharepoint page. When I reference the jQuery file uploaded in my library, I get this error message:

<FORM> tags are not supported in the HTML specified in either the Content property or the Content Link property. You can remove thetag, or use the Page Viewer Web Part, which supports the HTML<'FORM'>` tag. The Content property can be modified in the Rich Text Editor or Source Editor. More about the Page Viewer Web Part*

I checked the jQuery file and I found a Form tag, when I delete it the script does not work anymore.

Here's a screenshot ( in french ) enter image description here

In jQuery file ( the official jQuery library ) :

enter image description here

May it be because of this line ?

2 Answers 2

0

I've had issues referencing my .js file directly from a CEWP. What I do is reference a .txt or .html file that has a reference to my .js file. If this doesn't work then you have an error in your .js file.

8
  • thank you for your answer. it's jQuery file from Jquery website. It's just that CEWP when Including the file it detects <Form> tag. And that's not allowed. I don't know how to do to solve that..
    – infodev
    Commented Feb 7, 2017 at 20:47
  • ah, so sharepoint already has a <Form> tag that exists in the masterpage so you can't include another one, but the removal of the form tag from your file shouldn't prevent it from displaying ... can you upload your code or part of it? Commented Feb 7, 2017 at 21:02
  • OK i put to date my post
    – infodev
    Commented Feb 7, 2017 at 21:27
  • Have you tried using the .min version of jquery? It seems odd to me that SharePoint isn't just removing the forms tags...and it seems even more odd that jquery is trying to put form tags into your page. Commented Feb 7, 2017 at 21:50
  • same thing.. It contains <form>. and when I try to make a test in a script web part , the code pasted in disappear ..
    – infodev
    Commented Feb 7, 2017 at 22:04
0

Actually it won't matter if you will contain your form inside a '' tag (in sharepoint, there trapping it to block some unknown server side actions), you can still do it inside or any block elements, you will just need to wrap your function call in your button call it with jquery.

<div>
      <input type="text" id="mytextfield">
      <button id="mytextfield">Click me</button>
<div>

//on javascript file run the event with jquery

$("mytextfield").click(function(){ //run button logic })

Hope the concept helps, Happy coding!

Your Answer

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

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