I’ve been learning JavaScript for a college assignment and I can’t figure out why my point counters don’t work. I tried making a different program to figure out why at it seems that when I try to make the function availible for several variables, it stops working. Now this only allows itself…
Tag: html
On element click get text of a child element and pass it in an input field using jquery or plain javascript
As per title in my code below I have 4 divs that contains 4 different numbers. What i want is when i click on each div the amount of the clicked div to be inserted at the input field. My problem is that when i click any of the divs it pass all the amounts in the input field. Here
Beginner to React and Using React Router Dom v6 to navigate between pages
I’m struggling to navigate between different pages in react router I have my ReactDom.render() as follows: Here I have App.js with just my home and a second page (Park). If I place outside the tags the navbar is visible, but when inside the tags the navbar isn’t visible anymore. Then I placed my l…
How to change the value of a global variable when a user select an option
i have the html below where i let the user choose between two options After that i initialize a global variable that gets the “gr” value. I want to change the global value based on what the user chooses from the drop down menu (gr or en). On change selection event, i tried the code below but the v…
Angular: Scroll and focus to first invalid control in nested form once form has been submitted
I am trying to scroll and focus invalid control in form onsubmit. If I am using single form element its working as expected but when I am using nested form element not working. please find the sample example here stackblitz. How to scroll to invalid control and focus in nested forms on submit rootform. Answer…
How to hide div that has a table inside if the table’s is empty when filtering using search?
I’m trying to hide the whole div(where there’s a table inside) when the result from filtering/searching thru the table is empty. So far, I have this: As you can see, although the table is properly searched, the div and the table that has no value in its <td> is still showing. How can I hide …
Show last 5 submitted data using only JS and HTML
I have a small question, I am yet a beginner with Java Script and I don’t have that much of knowledge with it. My question is: I need to create a fake donation form. The form contains fields where the user can write his data like his phone number, donate amount etc… and when the user hit submit hi…
Looping through selectpicker options
I am working with a selectpicker that contains optgroup and option elements. I would like to loop through the options and “select” all options that have a value starting with a certain string. For example, if I have the following: and some buttons “Vegetable” and “Fruit”, I…
How do I change the function of a button more than 2 times?
I would like to make one button do 3 or more things one after the other. I’m trying to make a CYOA and I need one button to go through multiple layers/phases/sections(Start to layer 1 to layer 2) of the CYOA, with as little repeating code* as possible. I have placeholder text in the areas where the text…
Setting a limit for checkbox in js
I’m trying to make a form that sets a limit for 3 selection max or 1 minimum for my checkbox. I do get the error message once the condition isn’t set but I still can check them. How can I prevent that? and how can I prevent it from submitting the form when it happens? This is my JavaScript code