Skip to content

Author: admin@master

Get viewport/window height in ReactJS

How do I get the viewport height in ReactJS? In normal JavaScript I use but using ReactJS, I’m not sure how to get this information. My understanding is that only works for components created. However this is not the case for the document or body element, which could give me height of the window. Answer…

dataLayer.push() return value meaning

I’m struggling to implement Google Tag Manager at my job, I do have the problem that the administrator console is not available so I got to trust that the configuration is correct. Anyway, I initialized the dataLayer array, I included the GTM script and now some events are getting sent to Google. Enhanc…

Format credit card number

How to format and validate a credit card number with spaces between each 4 digit while typing: I have tried: Please help Answer Try this: Note: Check this for detailed information https://www.peterbe.com/plog/cc-formatter. To restrict the user to enter number only: Javascript Way OR HTML5 Way jQuery Way Note:…

owlcarousel – dots do not appear

I am working on a project and as my knowledge in javascript are very limited, I decided to use owlcarousel. everything was working fine but now I am facing a problem. I have set the dots to true but they do not appear. My work so far is the following: Please let me know how I can fix this issue

JS generate random boolean

Simple question, but I’m interested in the nuances here. I’m generating random booleans using the following method I came up with myself: Whenever random() shows up, it seems there’s always a pitfall – it’s not truly random, it’s compromised by something or other, etc. So, …