Questions tagged [document-ready]

Use this tag for questions about JavaScript functions that run after the page is loaded.

document-ready
Filter by
Sorted by
Tagged with
0 votes
1 answer
68 views

How to fix AsyncStorage has been removed from react-native core

i tried to authenticate my sign up with firebase so on the sign up screen the error only appear when i import { auth } from '../firebase'; if i comment it the code work fine but if try to use it in ...
Isco's user avatar
  • 3
0 votes
1 answer
59 views

Is this $(document).ready being fired twice?

This is the official shorthand for doc ready (in jQuery): // Shorthand for $( document ).ready() $(function() { // do something }); In some cases, we add document on handlers. For example: $(...
Kershaw's user avatar
  • 1,164
0 votes
1 answer
37 views

how to get the value of a radio button that is in a label in div inside document.ready

I know there are similar questions, but none of the answers worked for me. I am not that savvy with web development being primarily a data engineer. The following is a snippet of the code that ...
mkw's user avatar
  • 123
0 votes
1 answer
44 views

Why don't the buttons inside of my $(document).ready(function () call work when clicked?

I have a web page that loads up a table of data. That table is loaded and displayed successfully along with the buttons, however, when I click on button1 or button2, they don't display the alerts and ...
OminousWo1f's user avatar
5 votes
1 answer
2k views

window DOMContentLoaded vs document DOMContentLoaded

The modern replacement of the (on)"DOM ready" is the DOMContentLoaded event. You can listen on it on 2 global objects: window => https://developer.mozilla.org/en-US/docs/Web/API/Window/...
jave.web's user avatar
  • 14.5k
1 vote
0 answers
269 views

How can Chrome be forced to favor the anchor specified in URL over the last scrollbar position?

On a site that has an anchor in the URL, when you first go to it in Chrome, it jumps to that anchor properly. For example: https://plato.stanford.edu/entries/happiness/#HybAcc But then, if you scroll ...
user1886458's user avatar
0 votes
1 answer
542 views

Python Selenium: Switch tab without waiting for page to load

I am trying to change the browser tab while the current tab I am in is loading some javascript. When I try to do that, my program stops in the driver.switch_to.window(x) line and stays there until the ...
Pere Coll's user avatar
2 votes
1 answer
2k views

Can Selenium detect when webpage finishes loading in Python3?

In python I wrote: driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=chrome_options) driver.get(url) try: WebDriverWait(driver, 10).until( lambda driver: ...
Daniel's user avatar
  • 81
-1 votes
2 answers
1k views

How to execute JavaScript code when click Button in Webflow

I am newbie in Webflow, In Webflow project I want to get button by id and execute some Javascript code when I click this button. The code I write: <script> document.addEventListener('...
MrMustafa's user avatar
  • 305
0 votes
2 answers
874 views

Javascript not firing with dynamically loaded form and scripts

I'm loading a form and accompanying JS scripts into a modal via .ajax, but the JS isn't firing or initialising the elements as expected. (Nothing happens) The HTML and scripts work as expected ...
Colin R. Turner's user avatar
0 votes
0 answers
66 views

How to pass a variable from html to a document ready function

I need to pass a variable from my html code to the document ready function. my HTML code has <p>Welcome {{ajax_data}}</p>: ajax_data is being passed from my python code Now what I need in ...
Jaideep Banerjee's user avatar
1 vote
1 answer
573 views

What is the most efficient way to check if element exists in Selenium

Context: I mean to multi-thread several browsers instances and execute processes in them. Reason for question: I would like to know what is the most efficient/less consuming way to check for element ...
PayadorPerseguido's user avatar
0 votes
1 answer
193 views

How to make HTML filterable by every column (independently) using JavaScript?

Following the advice in this post I have created a table that can filter based on any column. How to filter a html table using simple javascript? But what I would like to do is use something simple ...
bart cubrich's user avatar
  • 1,234
-3 votes
1 answer
453 views

How to display a username in jQuery( document ).ready?

I am using WordPress, I added some content after a div class, is it possible to display the logged-in username inside this document ready? Here is my code. the shortcode not working inside jQuery, but ...
Nicholas Lee's user avatar
0 votes
0 answers
25 views

Why does the ready event not fire if the function is async [duplicate]

// Does not fire $(document).ready(async function() { alert("im ready"); }); // Does fire $(document).ready(function() { alert("im ready"); }); // Annoying fix $(document)...
John's user avatar
  • 6,129
1 vote
2 answers
449 views

Why does my $(document).ready(function()) not get executed?

I have a checkbox on my html view which looks like that: <input type="checkbox" id="hasPrereqBlock" name="hasPrereqBlock" onchange="hasPrereqBlockHandler(this)&...
lxg95's user avatar
  • 573
-1 votes
1 answer
49 views

Accessing a Declared Variable

Good time. How do I access a declared variable? I declare like this: $ (document) .ready (function () { var fotorama = $fotoramaDiv.data ('fotorama'); $ (document) .on ('click', '.btn-del-model',...
Omega-44's user avatar
-1 votes
2 answers
120 views

Try to call function defined in external js from jquery $(document).ready

Aim: When html page loads successfully, jquery $(document).ready gets called, then call function defined in external js inside $(document).ready. Note: jquery lib included hello.js function hello(){ ...
jiyi's user avatar
  • 101
0 votes
0 answers
26 views

How to do $( document ).ready() with webpack and babel? [duplicate]

I build with webpack and transpile with babel. The pages are generated in php. Once the js bundles are loaded, I want to mount a React component. I have been using jQuery for this, but it seems wrong ...
Meglio's user avatar
  • 1,665
2 votes
1 answer
1k views

document.querySelector inside MutationObserver: good or bad practice?

The objective and what I've tried I'm trying to get a method to be able to wait until an element is already in the DOM. I've read a few articles about MutationObserver, and I got this method which ...
Unapedra's user avatar
  • 2,223
-2 votes
1 answer
308 views

How to run a Javascript/Jquery Function using both $(document).ready(function() and Another Event Function?

I'm not a javascript/jquery coder, and not sure if what I'm trying to do is possible. I have a html/php/ajax form that is updated an sql database as the user fills it out. As they fill the form, there ...
JCBiggar's user avatar
  • 2,477
0 votes
1 answer
692 views

All content on page doesn't come up on first load, need to refresh and then it works

Technically there's no error, although when accessing a web page you don't want to have to refresh in order for things to load up, so the code is not running as efficiently and smoothly as possible. ...
powdercakez's user avatar
1 vote
0 answers
285 views

Angular and calling a JS event only once after document.ready()?

One of the things I'm still hung up on with Angular is understanding all of the lifecycle hooks and when to use what when. I often need to stick a little plain'ol JS into a component to deal with some ...
DA.'s user avatar
  • 40.4k
1 vote
1 answer
648 views

Does jquery $document.ready wait for json files to be loaded?

I get HTML configuration data from a json file. When that has loaded, I need to make sure that the document is ready before plugging the HTML into existing elements. var cfg; function ...
DeeGee's user avatar
  • 160
1 vote
2 answers
135 views

Is it possible to resume Selenium code when the browser lands on a certain url?

Simple question, is it possible to resume selenium code the moment the browser lands on a certain URL?
MadeInUtrecht's user avatar
1 vote
1 answer
107 views

document ready runs in a loop (after adding query string)

I have a action method that returns a view and pass a view model to the view, after calling this method in another section of my application with passing input parameter url will be look like this (...
farshad fahimi's user avatar
-2 votes
2 answers
581 views

in my javascript file, which executes first, initialization code or code in an $(document).ready() event

A project I am working on has some initialization code (not in any function) and some code in a jQuery $(document).ready() event. Which code executes first? Why? I'd also like to know why it might ...
user2967085's user avatar
-1 votes
2 answers
259 views

Why I have problem with $(document).ready?

I'm learning jQuery but I have a problem. Here the code: var script = document.createElement('script'); script.src = 'https://code.jquery.com/jquery-3.4.1.min.js'; script.type = "text/javascript&...
Jormungand's user avatar
0 votes
1 answer
644 views

Load html snippet using jquery

I'm fairly new to JavaScript and I'm trying to understand how I can load html snippets into a html page, but using an element trigger inside another snippet already loaded. For example, the below ...
MTavares's user avatar
0 votes
0 answers
27 views

in a .js file document.ready() is not firing first

Recently I upgraded jquery library to 3.5.1 after that document.ready() is not firing first In the ver 1.x it used to fire first.
user3249985's user avatar
6 votes
3 answers
5k views

Blazor Server App $(document).ready() equivalent

I have a Blazor Server app, I need to run a js function when the document is loaded - when I use "Static" mode, jQuery $(document).ready() works fine but I need to use "...
John Lee's user avatar
3 votes
1 answer
3k views

Vanilla JS ready() function - What is `document.documentElement.doScroll`?

I know similar questions have been asked here before, but I can't find any that asks or answers this specific question. I want an as simple as possible pure JavaScript ready function that runs when ...
Adrian Wiik's user avatar
1 vote
2 answers
1k views

componentDidMount() issue with starting jquery function - React

I'm working on ReactJS application. My $(document).ready(function(){}); stop working after I switch path with React Router Dom. I searched google to find solution for this issue. I find this article: ...
Gougerik's user avatar
0 votes
0 answers
68 views

AngularJS: Execute a JavaScript script after the page has loaded

I have to customize a platform designed in ASPX and AngularJS. I only have access to the HTML and CSS code, I do not have access to the AngularJS controller. I want to add a small JavaScript script, ...
Florian's user avatar
  • 11
0 votes
0 answers
523 views

When do I NOT use the $(document).ready shorthand?

I recently learned that $(function() { ... }); is just jQuery short-hand for $(document).ready(function() { ... }); Thus, isn't it best to have all functions in my Javascript style be a document ...
CodingMee's user avatar
1 vote
2 answers
99 views

Why $scope.value is only showing as prefilled textbox after we click on Text box and screen even using angular's ready function

I am trying to set value of ng-model named lastName using $scope.lastName="ThisIsLastname" in ready function. I can set value, It can be set also as I can see that in console but the problem is value ...
priyank patadiya's user avatar
0 votes
0 answers
13 views

Button will not 'auto click' after page load with my .js [duplicate]

I am trying to auto click a button on a page using code in a .js file. The button I want to click is: <input type="submit" class="btn btn-primary" value="Proceed to contract form"> Here is the ...
Zach's user avatar
  • 1
7 votes
1 answer
2k views

window.onload fires before jQuery document.ready in Firefox

I created a Codepen showing the issue: https://codepen.io/samuelg0rd0n/pen/ExVGQEV In Chrome, it correctly fires DOMContentLoaded event and jQuery document ready events before window onload events. ...
samuelg0rd0n's user avatar
  • 1,180
0 votes
2 answers
2k views

Is it possible to use JavaScript and JQuery at the same time?

Question provoked as I wondered if I can just declare $(document).ready() at the top of <script> and write regular vanilla JS inside of it so that I don't have to declare $(document).ready() ...
Kev's user avatar
  • 113
0 votes
0 answers
75 views

jQuery document ready not working when resizing elements

When I run the following snippet I try to get the height of the div id = 'imgLeft'. Sometimes it returns 18 and sometimes it returns correctly with 238.375. I also made the image clickable and ...
DCR's user avatar
  • 15.3k
0 votes
0 answers
63 views

Multiple file management in JQUERY application

How should Split JQUERY with multiple files or access variable inside one file1.js jQuery(document).ready(function($) { var a='Ram'; }); file2.js jQuery(document).ready(function($) { ...
indianwebdevil's user avatar
0 votes
1 answer
55 views

How to refresh part of page every 1min?

I want to refresh my specific div partition on page at every 1min. How can I do that? Here my test structure: <div id="test"> //something inside model items like @Model.TotalUpDeviceCount....
floopie's user avatar
  • 28
0 votes
1 answer
97 views

Hidden Field populated in Document Ready - Value not available in outer functions

I have a page which attaches a .change function to an input type="file" on Document Ready. This .change event function populates a hidden field: <script> $j(function(){ ... ...
CJH's user avatar
  • 1,446
0 votes
1 answer
7k views

Angular 9 - Equivalent of $(document).ready()

What is the Angular equivalent of $(document).ready() ? I want to execute a method once when the document is fully loaded (the method creates a component inside my component). None of the angular ...
Flyout91's user avatar
  • 822
1 vote
0 answers
342 views

Why cannot asynchronous function inside ready() method be called in jquery version 2.2.4?

I'm trying to nest some asynchronous works inside ready method but I'm getting stuck with jQuery version 2.2.4 (I prefer this version). With jQuery version 2.2.4 let initAsync = async function ()...
Tân's user avatar
  • 1
0 votes
1 answer
2k views

Run jQuery document ready function a second time onclick?

I am sorry, I know this might be a very basic question. I have a document ready jQuery function, that has various different functions inside itself. This function is triggered on every pageload. ...
арно нюм's user avatar
0 votes
0 answers
1k views

Using document.ready in a single page application

I have a Single Page Application (SPA) and I have some JS code with $(document).ready(function(){.... How can I make sure this function starts when a user browses another page and comes back because ...
jag's user avatar
  • 1
0 votes
1 answer
79 views

Add preventCollision and obstacle option, when page load

Here is this post: Prevent draggable divs from being placed near eachother And the jsFiddle source: https://jsfiddle.net/RichardGouw/h14jcqvx/28/ How can I add obstackle and preventcollision, when ...
earlmanster's user avatar
0 votes
1 answer
2k views

Check cookie on page load and update on button click

I am trying to if a cookie is set check on page load (cookieVal = 0). If not I want to show a Bootstrap 4 modal that contains two buttons. If a user clicks the Accept button ("cookiesAccept") then ...
user avatar
0 votes
0 answers
119 views

Why do I need nested jQuery document.ready functions?

I have some code: $(function(){ function foo() { var elem = $('.some-dom-elem'); console.log(elem); } location.reload = function() { foo(); // returns undefined } }); ...
user3259232's user avatar

1
2 3 4 5
15