I am currently working on some frontend development on a server. However when I try to add inline css and javascript for my password visibility toggle I keep getting the same CSP errors in google chrome. Refused to execute inline script because it violates the following Content Security Policy directive: R…
Tag: html
JS, navigator.mediaDevices.getUserMedia() not working
I’m trying to get video from client’s Webcam. I wrote the code, and no errors occurred. However, when I try to get video, nothing shows up (in Google Chrome) or just a single frame of the video is displayed (in Mozilla Firefox). I have tested it out before and it worked completely fine, but now, I…
React: How to change opacity of element by clicking button?
I want to change the opacity of headerInside element using React. I came up with this idea, but with use of the vanilla JS. How to write it using React hooks? The return() section looks like this: Answer Zrna’s answer got the point. I wanna change it a little .
How do I make text bold after the user clicks a button?
I am trying to make a text editor in JavaScript and it has various features like bolding the text and italics and some others. When the user clicks on any one of them, then anything that they have selected will become edited accordingly. Now I am able to get the selected text and even put strong tags before a…
Why isn’t the width of an image changing after I use “width: 8%;” in CSS?
I’m new to react and I was trying to make a simple website with music notes (just some images) and wanted each note to change color when hovering over it. I know I can do this with :hover, but I wanted to try out useState for practice. I finally got the toggle feature (just the feature that made it chan…
Why using SVG in cell forces table to 100% width?
I’m building table that should display data in a reasonable way. And don’t take 100% width if it’s not needed. The problem is that in one column I use line chart, and when I build that chart with div it works well, but when I use SVG the table takes 100% (I prefer to use SVG as it more flexi…
TypeError: Cannot read property ‘addEventListener’ of null when i want to add new elements to my database
I created a form to create new post from the auth users however im getting this error “Uncaught TypeError: Cannot read property ‘addEventListener’ of null” and cant seem to know why my script is at the end of the HTML and its an external file, I’ve used eventListener in other pla…
react set style value to unset
A component has right and bottom css properties that are set using a classname. And I wanted to overide those values using the style prop. But so far I could set numerical values like 10px or 0px and others, but was unable to set it to unset. So what can I do to set them to `unset`? So far I
How to get audio.duration from a player and save it to a div on a click?
I’ve been looking for a way to get the duration of a MP3 file that’s hosted remotely and I found answer from another question (How can I get the html5 audio’s duration time) and now I’m trying to see if I make it work. I’m hung up this part: What that code does is getting the dur…
How to center a button in Javascript
I am trying to center a button in Javascript so that it is horizontally centered in the page. Right now, my button is in a in my html file, so I don’t know how I can use CSS to center it since it’s in Javascript. TLDR: In Javascript, if I hvae declared a button btn, what code should I write