The div is populated after the onload event is finished

Currently, my onload event is functioning correctly. However, I am encountering an issue where the second part of the onload event calls another function before the first part is finished.

The initial part inserts information into an input field, while the second part executes a function using that information from the input field.

My dilemma lies in the fact that although both functions are working fine, the first part doesn't have enough time to input the information into the field and only does so after the fact.

Once the page is live, the first part will be dynamic and retrieve information from the URL.

onload = function(){

var tempURLtest = "http://ahoymearty.co.uk/shipyard/eNqrVipPTSzIzytWsoo2tjQ10TE0MzGFEMYGQEAMGaujlFiUm18EMsMUyLfQAZGWOuhsqAhQeXFBanJmYg5Ig6GZubGOsYW5uY6xmYWZjrG5MdBmSyOQQ8AmF2dngh0HZGaU5uR4uihZmRiZG+oopVYUpBaVOJVm5qQoWaUBDUutBQB8sDOU"
var fromURL =   tempURLtest.split("/")[4];  

//var fromURL   =   window.location.href.split("/")[4]  
document.getElementById("KixCode").value = fromURL

$scope.LoadKixCode()

}

Answer №1

Whenever you invoke a function that does not require any parameters, remember not to include the parentheses. For example, if you have a function named `a2()` { /// }, simply call it as `a2` without the parentheses.

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

Express.js Passport.js throws an error when req.user is not defined

The middleware function below is unable to access req.user or determine if the user is logged in after they log in. I have confirmed that passport.serializeUser is successful after logging in and that req is defined when accessed from the middleware funct ...

Choose2 incorporate on change

I have a Laravel project where I am using the vuexy theme. I've been trying to add an onchange event to my select2 input, but so far I haven't had any success. Here is my select2 input: <div class="col-12 mb-2"> <label class ...

Is it possible to convert a blob to an image file using the FileReader in HTML

client side code <head> <script> var reader = new FileReader(); var objVal; var image = new Image(); reader.onload = function(e) { document.getElementById('propertyImg').setAttribute('src', e.target.result); }; fun ...

The JSON on the Express page only appears after refreshing the page

When accessing my page at /id, the data pulled from an external API using Express does not display until the page is refreshed. Any suggestions on how to solve this issue? // Retrieves basic account data router.get('/:id', function(req, res, nex ...

Bookeo API allows only a maximum of 5 requests to be processed through Node.js

Greetings! I am excited to be posting my first question here, although I apologize in advance if anything appears unclear! My current project involves utilizing Bookeo's API to extract booking data from emails belonging to a tour company and transfer ...

Discovering nested documents in MongoDB using JavaScript

How to find nested data in MongoDB with the following collection: { "_id": { "$oid": "585b998297f53460d5f760e6" }, "newspaper": { "playerID": "57bffe76b6a70d6e2a3855b7", "playerUsername": "dennis", "player_newspaper": "{\"ID\":\" ...

What are the steps to executing a duplicated project in Node.js?

https://github.com/gleitz/mahjong Trying to set up this app on my Windows, following the provided instructions: - First, install dependencies with npm update - Then start the application with node app.js Seems straightforward, so I decided to give it a t ...

Utilizing ReactJS and TypeScript to retrieve a random value from an array

I have created a project similar to a "ToDo" list, but instead of tasks, it's a list of names. I can input a name and add it to the array, as well as delete each item. Now, I want to implement a button that randomly selects one of the names in the ar ...

import data from an excel spreadsheet and sync with ngGrid

Hello everyone, Is anyone familiar with a way to integrate ng-grid with Excel to allow for copy-pasting data from Excel into the grid? I've tried using the enableCellEdit attribute, but it doesn't seem to provide the functionality needed to wor ...

What is the best method to modify the accurate phone number within my script?

I need help with a text format script. link HTML CODE: <label for="primary_phone">Primary Phone Number<span class="star">*</span></label> <br> <input type="text" name="primary_phone" id="primary_phone" class="_phone requ ...

Creating a sticky popup feature for your Chrome extension

Just starting out with chrome extensions and looking to create one that appends an external class to a selected tag. For example, let's say we have the following tag: <h1>extension</h1> When the user clicks on this element, I want to ad ...

Can you explain how to use a toggle switch to make a select dropdown select a random option?

Currently, I am in the process of setting up a page for a character generator. Users will have the option to randomize traits or input their own. The interface includes toggle switches for the "choice vs random" options for each trait category, as well as ...

Is it possible to make a distinctive choice from the dropdown menu?

I need help with my html page that has 10 dropdowns, each with options 1 to 10. How can I assign options uniquely to each dropdown? For example, if I select option 1 in dropdown 1, that option should be removed from the other dropdowns. If I deselect an ...

What methods can be used to incorporate animation when the display attribute transitions to none?

Is there a way to add animation in a Vue app when replacing elements? I would like the transition from, for example, clicking on a div with 'Num 1' to the divs with class 'showing' not disappear abruptly but smoothly, such as moving to ...

Is there a way to execute a function only once when the submit button is clicked in a jQuery AJAX form?

I am using Django to create a website where users can create groups. To allow users to fill in group information and upload an image as the group logo, I have implemented an HTML form. In order to preview the logo before submission, I have used AJAX to upl ...

Iterating over ng-repeat, the initial item with a distinct directive

I have this code snippet: <div ng-repeat="i in placeholders" square class="set-holder {{i.class}}" droppable="{{i.type}}"></div> How can I ensure that the first item has the directive bigsquare, while the rest have just square? I attempted: ...

Increase the day count by 1 on every third cycle

I've been working on a code to increment the days in a date variable every third iteration using modulus. While I have managed to get the logic for every third iteration right, the day doesn't seem to increase by 1. I searched online and found s ...

Unable to display "xyz" using console.log() function upon button click

Why isn't the JavaScript function being executed in this code snippet? <form> <select type="text" name="month" id="month"> <option value="01">January</option> <option value="02">February</option> ...

"Encountering problems with location search function on Instagram API for retrieving posts

I've been working on integrating two APIs – Instagram and Google Maps. While I've managed to get everything functioning smoothly, there's an issue with displaying "up to 20 pictures" around a specific location. I'm unsure why this in ...

Distinguish between datalist selection and text input in BootstrapVue Autocomplete

When looking at the code snippet provided below, I'm trying to figure out the appropriate event/method to determine whether the value entered in the input field was manually typed or selected from the <datalist>. SAMPLE CODE: <div> &l ...