Skip to content

Tag: html

use “this” in a function passed to eventListener

Hello people I was refactoring some code and couldn’t figure a way to reuse the ‘this’: a/ Code I have b/ I want to move the function to another file and export it as: and use it like: but ‘this’ is undefined.. how do I bind it? Answer Pass this as parameter to function (and also…

Unknown problem with (probably) POST method

This task is quite simple but I just can’t seem to get it to work. What the outcome should be is explained in the picture below. I guess that there is some kind of a problem with POST in php, but I’m not sure. Do you see what’s the problem that’s causing this not to work? Problem: No r…

How to make navbar change color on scroll?

I have a transparent nav bar which on scroll is transparent. This means that if i were to scoll to a place that did not have a solid background color it would clash with other elements such as text. I would like to transtition into a different color to make it stand out more (including making the logo and a

filter value of select to do a partial sum

Having two classes professor and student: professor.ts student.ts To add up the scores of each student relative to his teacher I did: This is the HTML of the page: How can I do a partial sum of the selections, assuming for example that I have 5 professor with 1 student for every professor, and want to add onl…

Possible to execute script when loading local html file?

I am clicking on a link and loading in an html file which consist of: I then add this into a div on my page and it looks like: the script never executes… What am I missing? Loading the html like this: Answer Yep, modifying innerHTML won’t evaluate the script tags it inserts. You might want to do s…