Skip to content

Instantly share code, notes, and snippets.

@malipetek
Created November 11, 2023 12:34
Show Gist options
  • Save malipetek/d803381292636a36e6ebc74c31c258b5 to your computer and use it in GitHub Desktop.
Save malipetek/d803381292636a36e6ebc74c31c258b5 to your computer and use it in GitHub Desktop.
Convert this script from jquery to vanilla js. Be careful about null scenarios, for example when you convert $('.class').show() to document.querySelector('.class').style.display = 'block' keep in mind result of querySelector might be null. I solve this issue like this: (document.querySelector('.class') || { style: {}}).style.display = 'block'
Also use fetch and es6 as much as you can.
Do not make any explanations, only try to convert and comment the parts you think can not be converted easily.
Here is the script:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment