Import Javascript-File - how to use the code?
-
- Posts: 29
- Joined: Fri May 25, 2018
Hello,
i want to use an central JavaScript-File for different forms.
I add an html-control to the form with this code:
the code from "javaScript.js" is
If i run the Form the first line works well and the second not. If i set the same code into the JavaScript-Editor SP-Forms both lines works well. How can i speak to my controls, with an extern Javascript?
thanks in advanced.
i want to use an central JavaScript-File for different forms.
I add an html-control to the form with this code:
Code: Select all
<script language="javascript" type="text/javascript" src="../javascript.js"></script>
Code: Select all
alert("hello world");
$('#fd_form').append('it work's!!');
thanks in advanced.
Hi,
If you want to use jQuery and fd variables in a separate JS-file, you should declare them globally in the JS-editor:
window.$ = $;
window.fd = fd;
And then load your custom JS with $.getScript():
https://api.jquery.com/jquery.getscript/
If you want to use jQuery and fd variables in a separate JS-file, you should declare them globally in the JS-editor:
window.$ = $;
window.fd = fd;
And then load your custom JS with $.getScript():
https://api.jquery.com/jquery.getscript/
-
- Information
-
Who is online
Users browsing this forum: No registered users and 20 guests