Skip to content

Tag: javascript

Remove dots and spaces from strings

I want to remove dots . and spaces with regex text.replace(/[ .]+/g, ”). This is an 8-string 12.34.5678; and this is another 13-string 1234 5678 9123 0 okay? But the main problem is that it removes all dots and spaces, from the sentence. Thisisan8-string12345678;andthisisanother13-string1234567891230oka…

How can I disable image dragging on a element with Javascript?

I am unable to disable image dragging when using a <picture> element. I have used this in the past with an <img> element with success. I’m not sure why it doesn’t work with <picture>. HTML Code: My Javascript: The above did not work. Is there another way I can disable dragging of…

Uncaught TypeError: event.target is undefined

Using React and React-Dropdown package, I keep getting this Uncaught TypeError: event.target is undefined error whenever I select a year. Answer Looks like this package doesn’t pass in the event but only the changed value of the new selected option: https://github.com/fraserxu/react-dropdown/blob/master…

Rearranging a string to be a palindrome

I’m trying to solve the problem of: Given an array of strings with only lower case letters, make a function that returns an array of those same strings, but each string has its letters rearranged such that it becomes a palindrome (if not possible then return -1). I’m a bit stuck on how I should be…

Scanning an array js object

Hello, I want to make a basic visual editor for my plugins. I have an js object like this. I want to get all “components” properties in this. I am using a this function to convert js blocks to html. However this func is very bad :P. Please HELLLP… -Edit: How can I scan nested components prop…