Skip to content

Tag: javascript

Error “TypeError: $(…).children is not a function”

I try to select a certain DOM element with jQuery. The HTML content: I want to select Item #1. I used I got TypeError: $(…).children is not a function What’s wrong here? Answer You need to include jQuery in your page. Most browsers nowadays include a $() function in their console by default for ea…

getBoundingClientRect returning wrong results

I’m struggling a little trying to determine the current location and size of an element within the DOM. I’ve put together a fragment to illustrate a card based system down the right hand side of the screen. The behavior that I’m trying to build is that when you click on one of those cards, a…

Html5 video paused at specific time VideoFrame

For a project i need to pause a video at a very specific time. In order to be precise i watch the frame of the video using VideoFrame. demo here It’s works but i don’t understand why i need to click twice to relanch the video. Any ideas or others solutions ? Thanks Answer Push the video 1 frame af…

Am I using semicolons right in js?

I have been doing some basic js but I am not sure if I am using semicolons correctly. Here is my code: Please correct me in the comments if I am using them wrong. Thanks, Reece C. Answer Modify the following lines and it’d look good to me, semi-colonwise. The semi-colon is only required in JavaScript wh…

Is there destructor in typeScript

Is there destructor in TypeScript? If not, how can I delete an object? I tried destructor() and ~ClassName() but it didn’t work. Answer JavaScript uses garbage collection to automatically delete objects when they are no longer referenced. There is no concept of destructors or finalizers. You can’t…

OnChange event using React JS for drop down

The onChange event does not work. Answer The change event is triggered on the <select> element, not the <option> element. However, that’s not the only problem. The way you defined the change function won’t cause a rerender of the component. It seems like you might not have fully graspe…