problem arises when I attempt to use the code individually, as well as when I incorporate it into my existing

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>App Title</title>
<!-- Framework's CSS Files -->
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<!-- Our CSS Files -->
<link rel="stylesheet" href="css/custom.css">
</head>
<body>
<div data-role="page" id="main">
<div data-role="header">
<h2>All excersise</h2>
</div>
<div data-role="main" class="ui-content">
<a href="#pageone" class="ui-btn ui-icon-plus ui-btn-icon-left">Excersise 1</a>
<a href="#pagetwo" class="ui-btn ui-icon-plus ui-btn-icon-left">Excersise 2a</a>
<a href="#pagethree" class="ui-btn ui-icon-plus ui-btn-icon-left">Excersise 2b</a>
<a href="#pagefive" class="ui-btn ui-icon-plus ui-btn-icon-left">Excersise 2c</a>
</div>

    </div>
    <div data-role="page" id="pageone">

        <div data-role="header">
            <h2>show & hide</h2>
            <a href="#main">Back to home</a>
        </div>

        <div data-role="main" class="ui-content">
            <img id="showhide" src="assets/earth.jpg" />
            <a id="show" data-role="button" class="ui-btn ui-icon-plus ui-btn-icon-left" href="#">Show Image Senpai</a>
            <a id="hide" data-role="button" class="ui-btn ui-icon-minus ui-btn-icon-left" href="#">Hide Image Senpai</a>
        </div>
        <a id="show" data-role="button" class="ui-btn ui-icon-back ui-btn-icon-left" href="#main">home</a>

    </div>
    <div data-role="page" id="pagetwo">
        <div data-role="header">
            <h2>Calculator</h2>
            <a href="#main">Back to home</a>
        </div>

        <div data-role="main" class="ui-content">
            <form action="">
                <label for="num1">Number1</label>
                <input type="number" id="num1" />
                <label for="num2">Number2</label>
                <input type="number" id="num2" />
            </form>
            <a href="#" data-role="button" id="cal">Calculate senpai</a>
            <input type="number" id="result" contenteditable="false" />
        </div>
        <a id="show" data-role="button" class="ui-btn ui-icon-back ui-btn-icon-left" href="#main">home</a>

    </div>
    <div data-role="page" id="pagethree">
        <div data-role="header">
            <h2>age</h2>
            <a href="#main">Back to home</a>
        </div>

        <div data-role="main" class="ui-content">
            <form action="">
                <label for="namee">name</label>
                <input type="text" id="namee" />
                <label for="age">year</label>
                <input type="number" id="age" />
            </form>
            <a href="#" data-role="button" id="cals">Calculate Age senpai</a>
            <input id="ageres" />
        </div>
        <a id="show" data-role="button" class="ui-btn ui-icon-back ui-btn-icon-left" href="#main">home</a>
    </div>

<div data-role="page" id="pagefive">
<div data-role="header">
<h1>Greetings</h1>
</div>
<div data-role="main" class="ui-content"><div>
<label for="time">Time:</label>
<input type="number" id="time" min=0 max=24>
<button id="greet">Greet</button>
 <br><br>
<input type="text" id="result" readonly>
</div>
</div>

<!-- APIs js scripts --> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
 <!-- Our js Scripts -->
<script type="text/javascript" src="js/main.js"></script>

</body>

Hi. The code with greetings is not working when I use it with this code but when I use it separately it is working fine. when the user enters a number the input below must be filled with a greeting "good morning". Can you find where is the problem and explain to me why it is not working with the code because I have to study for an exam.

Answer №1

The issue arose from using duplicate IDs to hold a variable obtained from the input, specifically labeled as "result"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Posting Form Data with Ajax in CodeIgniter

Incorporating the CodeIgniter framework along with the jQuery Form plugin available at http://malsup.com/jquery/form/ Encountering challenges in ensuring proper functionality of a form. View <div class="row"> <div class="well c ...

The arrangement of pictures on a card

I decided to tweak the original concept by placing the images inside a Bootstrap card. However, the end result is that the images appear to be floating. https://i.stack.imgur.com/Uf721.png Any suggestions on how to make them fit nicely within the card? ...

jQuery fails to make a POST request when the content type is set to application/json

I am utilizing jQuery version 1.10.1. My goal is to execute a POST request with the content type set to application/json. The code I have implemented is as follows: $.ajax({ type: "post", url: urlBase + "user/search", contentTy ...

`How can I incorporate personalized animations on Google Map V3 Markers as they are individually dropped on the map?`

This is a basic example of dropping markers one by one on Google Maps V3. I have implemented the drop animation when adding markers to the map. However, I am interested in customizing the drop with a fade animation. Is it possible using JavaScript or any ...

Having difficulty changing placeholder text style in Scss

I'm a newcomer to SCSS and I'm attempting to customize the color of my placeholder text from light gray to dark gray. Below is the HTML code snippet: <div class="form-group"> <textarea class="thread-textarea" ng-maxlength="255" ma ...

Implementing automatic activation of a tab upon page load using Angular

I am currently working with a set of Bootstrap nav pills in my navigation bar. The 'ng-init' code in my Angular script sets the 'dateState' to 'past' on page load. However, I have noticed that the 'Past Events' nav p ...

Similar to Jquery ajax, Titanium also offers a powerful tool

Currently, I have been making an API call using Titanium in the following way: var url = "http://www.appcelerator.com"; var client = Ti.Network.createHTTPClient({ // callback when data is received onload : function(e) { Ti.API.info("Re ...

The hamburger menu on the navigation bar only functions the first time it is clicked

I've encountered an issue with my hidden menu nav bar. The hamburger and close buttons only work once. Should I organize the events within a function and call it at the end, or perhaps use a loop for the button events? It's worth noting that I d ...

Accordion Box glitch detected in Firefox browser

I have been working on a JavaScript function that controls a slide up/down box. However, I've encountered some issues with Firefox as the box only opens and closes once before failing to work properly again. Upon further investigation, it seems that F ...

Tips on maximizing the efficiency of ajax requests to MySQL databases

I have developed a website that needs to fetch data from a database every 2 seconds in order to display a dynamic market with changing prices and volumes. Below is the code I am using: $.ajax({ type: "get", url: "getData.php", data: { ...

Storing multiple values of dynamically added elements in a single variable and accessing them within a function

Is it possible to store multiple values into a single variable and then access them in a setTimeout function? $(document).ready(function (){ div ({'div':'#noo','auto':'true','pos':'top',' ...

Utilize the capabilities of the Dropbox Core API in Javascript to effortlessly transfer and store files on

I am currently developing a chrome-extension that has the ability to upload files to the user's Dropbox folder. I have implemented AJAX requests in my code to handle file uploads, and it is working fine for text-based file extensions such as .txt, .js ...

Preventing the element from breaking when it is not the child: Tips and Tricks

In order to align both .quote-container and #new-quote elements in the same line, even when the window width is very small (e.g., 83 pixels), I used min-width on the .quote-container element successfully. However, applying the same technique to the #new-qu ...

Tips for modifying the color of selected text

Is there a way to change the color of the dropdown text? Currently, it is set to red but initially appears as black. When clicked on, it changes to red. How can I make it so that the color is initially displayed as red? <select> <option style ...

During the click event, two distinct $.ajax requests interfere and cancel each other out

Here's a dilemma I'm facing: On my webpage, I have implemented two different click events. The first one opens a modal displaying a larger image when you click on a thumbnail picture (similar to Instagram on PC - I created an Instagram clone for ...

Triggering a button click to upload a file from within a grid view

I'm having trouble uploading a file when the "Fileupload" control inside gridview changes. I want to save the file content in DB as soon as it is uploaded by the user. I tried manually triggering the click event of the button control on the change of ...

Issue in PHP Wordpress when trying to access an index that is

I seem to be facing a common issue that others have experienced, but I can't quite figure out where the problem lies. (I've double-checked the isset() function in my code and it appears fine, yet it's still not allowing an email message to b ...

Tips for positioning a highcharts pie chart and legend in the middle of a page

I'm struggling to center my highchart data in a node/react single page application. Currently, it appears off-center like this: https://i.stack.imgur.com/ccR6N.png The chart is floating to the left and I would like to have everything centered within ...

When using equal-width columns in Bootstrap, the columns will be stacked one on top of the other

When I utilize Bootstrap 5, I am encountering an issue where equal width columns are being displayed one underneath the other. To illustrate, here is a simple example directly from the Bootstrap website: <link rel="stylesheet" href="https://cdn.jsd ...

I am trying to display my progress bar in a col-sm-6 format on screens larger than 546px, however, despite my attempts, I am not seeing any changes on the screen

Is there an alternative method if bootstrap is unable to handle this? I have used col-xs-6, but all I want is to display my progress bar in the image shown on small screens. Here is how I want to display my image on small screens. <div class="cont ...