Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Tim Cooke
Campbell Ritchie
paul wheaton
Ron McLeod
Devaka Cooray
Sheriffs:
Jeanne Boyarsky
Liutauras Vilda
Paul Clapham
Saloon Keepers:
Tim Holloway
Carey Brown
Piet Souris
Bartenders:
Forum:
HTML Pages with CSS and JavaScript
How to call JavaScript function in another JavaScript file
chamini prashakthi
Ranch Hand
Posts: 181
3
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If i have A.js
function a(){ //code }
B.js
function b(){ //code }
if I want to call for function a from B.js how to import A.js to B.js?
Tim Moores
Bartender
Posts: 7645
178
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If this is part of a web page, then you just need to load both script files (via <script> elements). After that, each method can call the other.
Sherin Mathew
Ranch Hand
Posts: 95
posted 5 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You can call function a by simply calling it in the js file.
A.js
function a(){ //code }
B.js
function b(){ //code a(); // Calling function a }
.NET Developer at iFour Technolab Pvt LTd
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Javascript import fails when using EL
Question about the 'this' keyword
How to call JavaScript Function from jsp
Calling Javascript function from Java Code
how to call javascript function of another jsp from one jsp
More...