Questions tagged [getelementbyid]

getElementById is an essential method commonly used in JavaScript in the browser to retrieve a particular element node in a HTML or XML document by its ID.

Filter by
Sorted by
Tagged with
0 votes
1 answer
24 views

getElementById returns null in JavaScript page building

I created the structure in JavaScript. I do not use HTML. I have a function that creates the structure and returns the root pane. function createEmptyChartPane (chartId) { let divelem = document....
Peter Horvath's user avatar
0 votes
0 answers
4 views

string in the search box for webview21

with old WebBrowser1 I can make WebBrowser1.Document.GetElementById("htlm string").InnerText = TextBox1.Text where htlm string is the string for find the search box of google or other engine ...
StefanoBon's user avatar
0 votes
0 answers
40 views

ExecuteScript(document.getElementById('form') in Webview2(C++) return null or some jQuery like string [duplicate]

I'm used webview2 executeScipt to access DOM but have some issue. html document is loading completed and then below c++ code called. only getElementById function not working, return null, but ...
tex1138's user avatar
0 votes
1 answer
45 views

Blazor JSInterop Getting Element Attributes from the DOM

I've made a Blazor Serverside Web App using the Visual Studio 2022 boilerplate project. I am still using .NET 7 as my company is slow to do updates. I have followed this tutorial on using the ...
Glen Hamblin's user avatar
-1 votes
1 answer
40 views

How can JavaScript format (Phone Numbers) two elements on the same page? [duplicate]

I have this script below that auto formats an element by ID. This works great on the singular element, but I have two forms on my site one in the top hero section and one at the bottom and I can't ...
killershot707's user avatar
-1 votes
2 answers
53 views

How can I write the content of a variable in image src while using document.getElementById?

I have the following code document.write("<img src=./", i, ".png width='100px' height='100px'>"); document.write("<img src=./", x, ".png width='100px' ...
itsmeroyd's user avatar
0 votes
1 answer
56 views

What's the difference between querySelector() and getElementBy[Id/ClassName/TagName]? [duplicate]

I don't get the difference between using querySelector() and, let's say, getElementById(). I understand that querySelector retrieves an element by using any selector, which makes it more versatile. ...
gorrangi's user avatar
-1 votes
1 answer
64 views

Calling an array in pokedex project

I have recently designed a pokedex and have created an array with all the pokemon ID's and class's like so. const pokedex = [ { pokemon: 'bulbasaur', dexInfo: [ { dexName: 'bulbasaur-name' ...
ryanl's user avatar
  • 1
0 votes
5 answers
90 views

How to access a class within a parent element in javascript

Looked in the 'Similar Questions' list and found one that was almost what I needed, but not quite... What I need is to modify the properties of a class that is within 3 different elements. Thanks for ...
CJ Reynolds's user avatar
0 votes
0 answers
8 views

I need to be able to remove all leading letters from user input for var custint = document.getElementById("custint").value;

The input might contain no letters, but could contain two or more letters.I only need the information beginning with the first number for the output. There will be forward slashes between numbers that ...
Kevin's user avatar
  • 1
0 votes
0 answers
31 views

Required tooltips on submit form does not appear after the scroll animation

I´ve been trying to make this tooltips appear without using js or something else than bootstrap classes and the required attribute. The problem is that my form is using a prevent default function on ...
Israel Ornelas's user avatar
0 votes
2 answers
50 views

playerSelection() is not returning but its getting passed a string value? [Rock paper scissors game]

Hello, i am currently revisiting a rock paper scissors game in html/css/javascript. Now i am trying to make a corresponding website where you can click the button and it logs your playerChoice in that ...
Korekollum's user avatar
1 vote
1 answer
73 views

Can't use const/var outside of a function

This a javascript script working on Tampermonkey I can't use my const idElement outside of my timed function. I need to use the value of my get in the sendEmail function. I can't use getElementbyId in ...
Adi Lasri's user avatar
1 vote
1 answer
50 views

Passing through a parameter to document.getElementById when using it in Nightmare evaluate()

I am trying to run my checkPrice function with parameters that I pass in: const nightmare = require('nightmare')() let url = "https://www.amazon.co.uk/Guards-Discworld-City-Watch-Collection/dp/...
user22422416's user avatar
-1 votes
1 answer
69 views

How to return array using DOM getElementById [duplicate]

code.js(js file) let winter = ["applle","orange","grape"]; console.log(winter); document.getElementById("fruits").innerHTML = winter; <h1 id="fruits">fruit stall</h1> Why it's ...
Learner's user avatar
0 votes
1 answer
52 views

Error returning value null with using toggle switch in Javascript

<div class="form-group col-3"> <div class="custom-control custom-switch custom-switch-off-danger custom-switch-on-success"> <input type="checkbox" class="custom-control-input" ...
Gunners80's user avatar
0 votes
1 answer
27 views

Why would the same getElementById code work for one section but not the second section? [closed]

I have 2 fields (machine & plant) that need to be autogenerated from the selection the user picks in the input field. 'Machine' has an array set up for the drop-down choices while 'plant' has ...
DisgruntledMonky's user avatar
0 votes
1 answer
14 views

getElementById returning undefined

I created the HTML file below to resolve why getElementById is not working. I must be doing something wrong, but what? <!doctype html> <html> <style> .is-hidden { display: none; ...
Grampanda's user avatar
0 votes
1 answer
104 views

Not able to use find element by id on browser stack using appium 2.0

I am using following : Code is in C# Appium 2.0 Device or env Browser stack When i am trying to use my code to find element by id on above i am not able to find the element by id but when i use same ...
shantanu kulkarni's user avatar
0 votes
0 answers
12 views

How to combine form action with getElementById

I'm newbee and would like to ask question. I want to develop a quiz on my website. And I use sheetmonkey to collect data when an user submit the form. Also, I want my website to response a score when ...
Kieu Anh's user avatar
0 votes
1 answer
66 views

Receive the value of an input field in the backend: Django

This is a follow-up to my previous question How to get the value of input field entered in navigation . I'm trying to get the value of an input field in the backend- Django. In views.py, I've included ...
Natasha's user avatar
  • 1,181
0 votes
1 answer
58 views

How to get the value of input field entered in navigation

I'm trying to get the value of an input field. Code: <input id="examples" class="input" name="examples" placeholder=" " /> ...
Natasha's user avatar
  • 1,181
1 vote
1 answer
32 views

Add text to an input field in navigation bar by clicking text

I'm trying to add text to an input field defined in navigation bar (left) shown below. When #2 is clicked, I want the text to be set to it's value. <span id="example2" class="...
Natasha's user avatar
  • 1,181
-2 votes
1 answer
60 views

Show a div when a cookie exists in Javascript

I want a div to show when a visitor has a cookie and hide when the cookie is not present. I know the cookie is being detected but for some reason, the display part of getElementByID is not working. I ...
user2976328's user avatar
0 votes
2 answers
50 views

In what cases should you use querySelector over getElementById?

I'm fairly new to JavaScript, HTML, and CSS, and while I was making a simple trivia website,and I noticed that when I tried comparing a users input to the expected text input using getElementById, it ...
Eric Jones's user avatar
0 votes
0 answers
58 views

Why am I getting a 'subscript out of bounds' error when using getElementText() with RSelenium using Docker?

I am using docker with RSelenium to pull text from dropdown menus on a website using code that worked last year, but this time I am getting the error: "Error in resContent[["status"]] :...
K S's user avatar
  • 1
0 votes
0 answers
11 views

Form substitution from DOM , element with id

Form substitution from DOM , element with id A brief description of the task and the problem encountered. Task. Services network page. When you click on the button (order a service), a modal window (...
Vadim Kilikov's user avatar
0 votes
0 answers
48 views

How can I force keyboard shortcuts on a video player?

I use a certain hub website using only one hand and for some years now this certain website make things akward for me when using some keyboard shortcuts to play/pause and seek in the video. Problem: I ...
Jared's user avatar
  • 1
1 vote
1 answer
226 views

how do I save a button that has been clicked to local storage?

I have x amount of buttons, I made it so when a button is clicked it turns green or clicked again it will go back to its default grey. its a collection list to keep track of things acquired vs. not. ...
Sinister's user avatar
0 votes
0 answers
40 views

I can't get the right access to the elements inside the IFRAME tag

Faced with such a problem. I am creating an extension for the backend of one service. There was a need to integrate information from one page into another. I decided to use the IFRAME tag to access ...
Павел Шоломицкий's user avatar
0 votes
1 answer
41 views

Variable is true but images are not turning to Gifs - Class / ElementID

I am trying to turn an image to a gif instead when GifsActive is true which it is when someone ticks the box. I have tried to create functions in the class and outside and call them, but this doesn't ...
Yosuf's user avatar
  • 11
0 votes
0 answers
55 views

window.scrollTo is returning an uncaught typeerror [duplicate]

Here is my code function scroll(ID) { var item = document.getElementById(ID); var pos = getPosition(item); window.scrollTo({ left: pos['left'], top: pos['top'], behavior: "...
RGB_CATT's user avatar
0 votes
1 answer
128 views

How can I access a HTML element via NodeJS without the need for third party libraries

So the issue is that I am trying to get a html element and change the innerHTML of it. Before anything else I will first say that my app requires to be connected to a database and also needs to ...
AbdullahCoder's user avatar
0 votes
0 answers
32 views

no such element: Unable to locate element: {"method":"css selector","selector":"#ext-gen275"}

getting unable to locate element exception driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(50)); driver.findElement(By.id("button-1205-btnIconEl")).click(); // String ...
Hemanth Kumar Rayapati's user avatar
0 votes
2 answers
102 views

Use variable in 'document.getElementById("…")' for IDs to reduce duplicated code

I have written a dice roller utility for a tabletop RPG in JavaScript. Before I add more functionality to it, I would like to simplify the code by simplifying functions to remove unnecessary code. ...
Richard Cosgrove's user avatar
1 vote
2 answers
79 views

How to "take" a value -when it appears- to do something else?

I´m starting to learn JS, so I have very basic questions about it... In this case, I´m trying to do a "tennis points" counter. So, I made that, and when some player gets to 45 points, the ...
Fonsecar's user avatar
1 vote
2 answers
55 views

how to change color in cell without typing 25 functions

i have a problem with table <td id="1" onclick="func1()">1</td> <td id="2" onclick="func1()">2</td> <td id="3">3</...
Johnyy's user avatar
  • 23
0 votes
1 answer
45 views

Why does a previous name I inputed repeat itself each time I input a new name on a form and click on add?

JavaScript: My form input value keeps repeating itself. Each time I enter a new name in the input field and click on the add button, the previous name I entered repeats itself and the new name is also ...
GMK's user avatar
  • 23
0 votes
1 answer
37 views

I can't properly print values from an input by using document.getElementById();

I can't properly print values from an input by using document.getElementById(); <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta ...
Edu's user avatar
  • 1
1 vote
2 answers
352 views

How to display different texts depending on the browser language?

let language = navigator.language; switch (language) { case es : document.getElementById("demo").innerText = "Hola "; break; case en : document....
al3j4ndr0's user avatar
0 votes
1 answer
164 views

How can I navigate to a new page based on the image selected that was pulled form an API in react?

I have a personal movie database website I'm working on with react.js. The homepage displays a main recommended random movie, and then specific rows of movies. These movies are all generated by using ...
McKay's user avatar
  • 3
0 votes
1 answer
56 views

Unable to style 'ul > li' elements using : document.getElementById() / ClassName() / TagName() / etc

function myFunction(e) { if (e.deltaY > 0) { let nav = document.getElementById('navbar').style; let navImg = document.getElementById('navBrand').style; nav.height = '6vh'; nav....
MUB's user avatar
  • 13
0 votes
3 answers
51 views

action-btn needs two clicks to perform the click

var button = document.getElementById("action-btn"); button.addEventListener("click", function(){ var container = document.getElementById("mostrarc"); if(...
viniwest's user avatar
-1 votes
2 answers
82 views

CSS/HTML/JS - GetElementByID and html/js element spacing issue

I am an amatuer at javascript/html/css programing. I developed a java backend and I am in the process of developing a convenient frontend webui for it. I want to display buttons in a tree format. All ...
ItsRainingHP's user avatar
0 votes
3 answers
71 views

javascript removing element by ID only working for latest child element

I'm making a dynamic list where users can click a button to remove inputs. When creating new inputs I'm assigning an ID to the child element with a counter that adds 1 every time a new input is ...
user8188120's user avatar
0 votes
2 answers
97 views

why won't any of my JavaScript work in my html?

first off I have both my JavaScript and my html files in the same folder. I cannot understand why none of my javascript works in the html file. I have tried putting the Script directly into the html ...
Adam Brame's user avatar
0 votes
0 answers
33 views

Check if there is an inscription on the page + accept cookies

I'd like to search the website and see if it says "Red", but first I need to accept cookies. How can I do it? For example: from urllib.request import urlopen link = "https://www....
Mass Stream's user avatar
0 votes
1 answer
46 views

Game loop not resetting the game after killer is revealed / killed

I am trying to create a surivor game vs killer and once the killer is revealed at the end, it will tell who the killer is at the end of the game when there's less than 4 cast members left. When I try ...
Yosuf's user avatar
  • 11
0 votes
1 answer
33 views

How to get the value of a function to use on end of GetElementByID.SRC

I've got a function that picks a random image out of the three in the array, however I want to display one of the 3 images randomly at the end of the GetElementByID.SRC code so it randomly picks a ...
Yosuf's user avatar
  • 11
0 votes
0 answers
466 views

show/hide a tab element using content tabs in elementor

Im working in elementor free and using the "content tabs" widget from the unlimited elements plugin. I have a couple of tabs, one of which i only want to show when the url has a certain word ...
Jeaneliz deNys's user avatar

1
2 3 4 5
49