Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8352093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:52:04+00:00 2026-06-09T08:52:04+00:00

I have the following in my main html: jQuery(document).ready(function(){ jQuery(‘body’).flvplay(songlist, {something});}); I wanted to

  • 0

I have the following in my main html:

jQuery(document).ready(function(){
jQuery('body').flvplay(songlist, {something});});

I wanted to move this to a separate JS file and make a function call from the main html. I created the new JS with the following:

play()
{
jQuery('body').flvplay(songlist, {something});
}

Finally, I called the play function from the main html after including the new JS file:

<script type="text/javascript">
play();
</script>

This is not working for some reason. Is there anything wrong with the above? Thanks for helping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:52:05+00:00Added an answer on June 9, 2026 at 8:52 am

    You need to declare functions using the function keyword:

    function play()
    {
        jQuery('body').flvplay(songlist, {something});
    }
    

    Additionally, you deleted $(document).ready(...), which is important because otherwise you might be trying to manipulate elements that do not exist because they have not loaded yet. You may want to modify your calling code to look like this:

    $(document).ready(function() {
        play();
    });
    

    If you don’t use the function keyword, the code in the referenced file will be parsed like this:

    play()  // call the function `play` (which has not yet been defined)
            // as it does not yet exist, an error is thrown and execution is halted
    {  // open a block (which is not useful here,
       //               since JavaScript has no block scope)
         jQuery('body').flvplay(songlist, {something});  // do something with body
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following structure of an HTML document: <body> <div class=main> <div class=left></div> <div
I have the following situation. My project has a main.scala.html file and a folder
I would like to have the following kind of HTML: <header></header> <div id='main'></div> <footer></footer>
I have a HTML table with following content. <table class='main'> <tr id='r1' class='tbl'> <td>V1</td>
I have the following HTML: <ul class="main-navigation"> <li class="left">&nbsp;</li> <li class="normal">Home</li> <li class="normal">Internet</li> <li
I have the following html: <!-- MainMenu --> <ul class=main-menu> <li><a href=About/xxxxx>About</a></li> <li><a href=Services/xxxxx>Services</a></li>
I have the following html <ul class=links main-menu> <li class=menu-385 active-trail first active><a class=active
I have the following jQuery code: function showResult(str) { if (str.length == 0) {
I have the following HTML. div#main-content div#right-col div#post-show div#post-img div#post-img-large{ } div#main-content div#right-col div#post-show
I have page main.html in it i have this code in the body tag:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.