Skip to content

Tag: html

How to format JavaScript generated HTML code?

I am trying to make a function which can generate tables from the data passed. The data is supposed to be in this format: Here the entire array is one table, arrays inside it are rows, and objects inside them are data for each cell inside the row. The problem is that when I use this function on this data:

detect outside table row click

How can I detect if a mouse click was not done on a table row? I created this table, which can be modified on the fly and highlights the selected row, if selected. Now I try to establish a function, which removes the row highlighting as soon as a mouse click was not done in one of those table rows.

populate select on page load

I’ve got it working for the first element, but as soon as i try to press another element it repopulates itself and selects the first element. HTML: Population: Necessary Information: I need to add the EventListener to every element of the NodeList as every Element is a select that needs to be populated.…

Problem viewing a div with a simple function

I have a problem I would say stupid with html and javascript, a simple function that should make me visible and invisible a div crashes the html making it empty! js: before: after: Answer You don’t have to write pre-defined methods. It works same for all other tech stacks such as Mysql, PHP, etc. Recomm…

problem with circular rotating text on browser resize

I have a circle of text that rotates as you scroll down the page which is working absolutely fine. I have set the text to ‘display: hidden’ when the browser width is below 768px, if you decrease the browser width to below 768px it is hidden, then once increased it is visible again, this is working…

Show/hide between two elements randomly onload

I have two elements, .a and .b. By default, both elements have display: none. I want to make one of the two appear randomly when the page loads. Sometimes .a appears, sometimes .b appears, by giving the class .c which will provide display: block. This is what I have tried but failed because sometimes both are…