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 8160515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:15:58+00:00 2026-06-06T18:15:58+00:00

I’m building offline application with phonegap + jqm. All app pages are in separate

  • 0

I’m building offline application with phonegap + jqm. All app pages are in separate files. Sample of my page file structure.

<div data-role="page" id="page2">
   <script type="text/javascript">
       ... Necessary javascript to create page content ...
   </script>

   <div data-role="header"><h3>Header</h3></div>
   <div data-role="content">Content</div>
   <div data-role="footer"><h3>Footer</h3></div>
</div>

Is it good way to write js code inline with page markup? To me, it is clear and convenient. I see and can write all necessary code for current page. I don’t want write all code responsible for creating page content in just one file than to include in header.
So, is it OK?

  • 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-06T18:16:00+00:00Added an answer on June 6, 2026 at 6:16 pm

    Functionally the end result is the same whether your JavaScript is inline on the page or whether you link to it, so you can if you want just place all your JavaScript inline.

    That said It’s generally a good idea to separate your code from your markup, doing so helps to keep things more structured and makes it easier to reuse code. For example in your case you can have a page specific JavaScript file for each of your pages, as well as some JavaScript files each containing code that might apply to more then one page which you can now easily reuse in any one of your pages by linking to it.

    The fact the your app is offline shouldn’t really make any difference as far as the benefits of separating your JavaScript goes.

    I don’t want write all code responsible for creating page content in
    just one file than to include in header.

    Two things, first there is no reason to keep all the code in one file, use as many as necessary (in a regular web page you might want to combine them before publishing but since this is a offline phonegap application i don’t think it makes a difference. Second it’s generally considered good practice to place your JavaScript files on the bottom of your page so it doesn’t block the rest of the page from loading.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
Basically, what I'm trying to create is a page of div tags, each has
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:

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.