event.preventDefault() not working in chrome
event.preventDefault() not working and submitting the form immediately takes to other link.
How can I make the game Rock, Paper, Scissors move forward between rounds using the DOM in javascript?
I hope you can help me. I am making the game Rock, Paper, Scissors in JavaScript, and I am stuck. The problem is that I can’t make a loop work to allow me to play 5 rounds in the game, keep a round counter, and update the score. The game is for practicing DOM manipulation.
Get index position of cursor and modifying a contenteditable field with rich text
I am working on a html editor and am currently trying to implement rich text functionalities into the program. Right now, I am having difficulties trying to determine the overall position of a node in relation to the commonAncestorContainer.parentElement
of the input, but the way I’ve been doing this is with .indexOf, which works fine if it is the only occurrence of that line in the element, but if there are duplicates it would bold, italic, etc. the wrong element.
.textContent returning empty string despite having content in Javascript
I am making a three.js site (although I don’t think this is relevant) and have the following function:
Can’t access shadowRoot
I want to pass a captcha on website https://sirus.one/#play and I need to set the solved captcha value in textarea.g-recaptcha-response -> div.innerText. TextArea has shadowRoot where website saving the response of recaptcha.
How to statically clone an element
According to mdn, querySelectorAll returns a static NodeList. In my example below, clicking the copy row
button will deep copy row0
container of checkboxes to row1
and append it to the DOM. However, it also seems to copy the live state of the checked
property of checkboxes. Additionally I noticed the id
properties of the new checkboxes were not updated. How can I deep copy an element in its intial state and then update its id
properties?
How to have onclick return a second result
I’m completely new to listeners in javascript (learning DOM manipulation) and currently I have these functions that turn a box into a new looking box on a click:
How to get position of *content* of element in Javascript
I know about element.getBoundingClientRect()
. It returns a DOMRect
that contains the element including padding and border. How can I get a similar thing which does not include the padding and border?
Difference between changing images in javascript using querySelectorAll and document.getElementsByClassName(“”);
I am developing a webpage containing the functionality of changing the image of a html page on reloading it according to a random number generated. I’ve tried it out using two methods:
In the first method I used querySelectorAll property of DOM and in second method I used document.getElementsByClassName(“”);.
Javascript-Difference between changing images in javascript using querySelectorAll and document.getElementsByClassName(“”);
I am developing a webpage containing the functionality of changing the image of a html page on reloading it according to a random number generated. I’ve tried it out using two methods:
In the first method I used querySelectorAll property of DOM and in second method I used document.getElementsByClassName(“”);.