Skip to content

Tag: javascript

How do you dynamically set a recipient in a mailto link?

I’m trying to dynamically set the recipient of my mailto link in javascript. I thought that I could just put a javascript variable in the recipient place of the link, but I get errors when trying to do so. Anyone have any suggestions of why this might not be working? This is what I currently have, which…

DayJS isValid behaves differently to Moment

I was trying to validate birthday using dayjs but its isValid is returning true for a date that doesn’t exist. Funnily enough, the isValid by moment is working just fine. I can’t switch to moment because of the lightweightness of dayjs Any idea how to tackle this? Answer Please look at this thread…

How can I use snap.svg with external files?

I know I can use an inline <svg> element to load snap svg. However I would like to use an non-inlined file via an <img> element: Where someGroup is an svg g element, fails. group is null. Additionally: Shows this is an Element rather than a Snap instance. How can I use snap.svg with external files…

How to clear react state in modal after closing?

I’ve got a product card with product details shown. On the bottom, there is an ‘edit’ button. When clicked it shows a modal with prefilled input fields, that can be edited then saved. Modal can also be closed without saving (but with input fields edited). My problem is that when a user edits…