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

  • Home
  • SEARCH
  • 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 8261033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:15:43+00:00 2026-06-08T03:15:43+00:00

Is it only allowed to bind 1 event to 1 thing? What I mean

  • 0

Is it only allowed to bind 1 event to 1 thing? What I mean is, that I have 2 js files I want to initialize on the same page load.
So I have tried the following:

js1 / Mapmode.js:

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

function initMapModeContent(){
    alert('test');
    initPageHeader();
    var oldHTML = document.getElementById('mapmodeContent').innerHTML;
    var newHTML = oldHTML + '<div><a href="pages/Beskeder.jsp#beskeder" id="mapLink" name="mapLink"><img id="mapLinkImage" alt="a map which links to the beskeder" src="images/beskeder.png"/></a></div>';
    document.getElementById("mapmodeContent").innerHTML=newHTML;
}   

js2 / PageHeader.js:

$(document).on("pageinit", "#mapmode", function(event) {
        initPageHeader();
    });
    $(document).on("pageinit", "#beskeder", function(event) {
        initPageHeader();
    });

    function initPageHeader() {
        var id = document.getElementById('header').parentNode.id;
        //TODO getdata with the id(page we are currently on).
        $("#header").html(function(index, originalMarkup) {
            return '<a data-theme="a" data-wrapperels="span" data-iconshadow="true" data-shadow="true" ' + 'data-corners="true" class="ui-btn-left ui-btn ui-btn-up-a ui-shadow ui-btn-corner-all" href="#" ' + 'data-rel="back" data-role="button"><span class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">' + '<img src="../images/back.png" alt="back" align="middle" vspace="2"></span></span></a>' + '<h1 aria-level="1" role="heading" class="ui-title">' + '<img src="../images/main_header.png" alt="logo" align="middle" vspace="2">' + '</h1><a data-theme="a" data-wrapperels="span" data-iconshadow="true" data-shadow="true"' + 'data-corners="true" class="ui-btn-right ui-btn ui-btn-up-a ui-btn-inline ui-shadow ui-btn-corner-all" ' + 'href="#first" data-role="button" data-inline="true"><span class="ui-btn-inner ui-btn-corner-all">' + '<span class="ui-btn-text">' + '<img src="../images/home.png" alt="picture to take you to the first page" align="middle">' + '</span></span></a>';
        });
    }

html5:

<%-- 
    Document   : mapMode
    Created on : Jul 12, 2012, 10:36:22 AM
    Author     : ame
--%>

<!DOCTYPE html> 
<html>
    <head> 
        <title>Map</title> 
        <meta name="viewport" content="width=device-width, initial-scale=1"> 
        <link rel="stylesheet" href="js/jquery.mobile-1.1.0.css" />
    </head> 
    <body> 
        <!-- Start of first page -->
        <div data-role="page" id="mapmode" name="mapmode">

            <div data-role="header" id="header" name="header">

                                <p>TEEEST</p>
            </div><!-- /header -->

            <div data-role="content" id="mapmodePageContent" name="mapmodePageContent"> 
                <p>I'm the first page in mapMode!.</p>      

            </div><!-- /content -->
        </div><!-- /page -->



        <script type="text/javascript" src="../js/jquery-1.7.2.js"></script>
        <script type="text/javascript" src="../js/jquery.mobile-1.1.0.js"></script>
        <script type="text/javascript" src="../js/Mapmode.js"></script>
        <script type="text/javascript" src="../js/PageHeader.js"></script>

    </body>
</html>

I just can’t find in documentation that it shouldn’t work? any suggestions for how it can be made, if it is not legal, or anyone that can spot my error.

It works in PageHeader.js but not in Mapmode.js, which is why I ask this.

  • 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-08T03:15:45+00:00Added an answer on June 8, 2026 at 3:15 am

    .on() attach an event to a selector.

    You can assign any number of events to it like click, submit etc…

    But I think it is not wise to assign same event more than once to the same element. I think only the last attached event will fire.

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

Sidebar

Related Questions

I have a requirement that a user is allowed only to enter string value
I have an asmx web service that should only be allowed to respond to
I thought that Ruby only allowed single inheritance besides mixin. However, when I have
How do I create a MS SQL server user that only allowed to read
W3 specifies that only four CSS rules are allowed for table columns (with the
Supposed that for some reason you are only allowed to use static memory in
I would like that only certain applications can perform bind to a service. Can
I am only allowed to use private members in the programming course I'm taking,
I need some help with a textbox: The textbox is only allowed to contain
Are these nested comments allowed in a XML file? <!-- Making only one observation

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.