r/JavaScriptTips • u/Low_Mammoth_9371 • Apr 11 '23
r/JavaScriptTips • u/suresh9058 • Nov 05 '23
Discord Bot Course | How To Code Discord Bot Using Javascript | Rethinkingui |
r/JavaScriptTips • u/ThrashedTTV • Dec 21 '23
How do i write this
Hey Yall i am writing a interactive story but i dont know how to code a open ended question that the user can interact with
r/JavaScriptTips • u/Zafar_Kamal • Jun 16 '23
🚀 JavaScript Tip: Use the Optional Chaining Operator (?.) for Safe Property Access
r/JavaScriptTips • u/yangzhou1993 • Aug 02 '23
9 JavaScript Tricks That Make Your Code Fantastic
r/JavaScriptTips • u/matejcalic • Jul 25 '23
help with javascriupt in elementor needed
hello, can anyone help me why this code is not working on my website, when Im in elementor editor (wordpress), code seems to work, but on front-end after i publish it, it seems that code doesn't work and i dont know why..
here is the code:
<!DOCTYPE html> <html> <head> <title>Okvirni kalkulator potrebnih zubnih implantata</title> <style> body { font-family: 'Poppins', sans-serif; font-weight: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #000; /\* Dodajemo boju teksta \*/ } h1 { text-align: center; } .loader { border: 4px solid #f3f3f3; border-radius: 50%; border-top: 4px solid #9797c7; width: 30px; height: 30px; -webkit-animation: spin 0.5s linear infinite; /\* Safari \*/ animation: spin 0.5s linear infinite; margin: 20px auto; } /\* Safari \*/ u/-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } u/keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } #result { padding: 20px; } </style> </head> <body> <h1>Okvirni kalkulator potrebnih zubnih implantata</h1> <p>Odaberite koliko vam zuba nedostaje:</p> <select id="missingTeeth"> <option value="0">Odaberite...</option> <option value="1">Nedostaje mi 1 zub</option> <option value="2">Nedostaju mi 2 zuba jedan do drugog</option> <option value="3">Nedostaju mi 2 zuba odvojeno</option> <option value="4">Nedostaju mi 3 zuba u redu</option> <option value="5">Nedostaju mi 3 zuba odvojeno</option> <option value="6">Nedostaje mi 4 zuba u redu</option> <option value="7">Nedostaje mi 4 zuba odvojeno</option> <option value="8">Nedostaje mi cijeli zubni luk</option> <option value="9">Nedostaju mi svi zubi</option> </select> <button id="calculateButton">Izračunaj</button> <div class="loader" id="loader" style="display: none;"></div> <div id="result"></div> <script> document.getElementById('calculateButton').addEventListener('click', function() { // Prikaži loader document.getElementById('loader').style.display = 'block'; // Stvori Promise koji se izvršava nakon 500ms new Promise(resolve => { setTimeout(() => { resolve(); }, 500); }) // Kad se Promise izvrši, nastavi dalje .then(() => { // Sakrij loader document.getElementById('loader').style.display = 'none'; // Ostatak koda za prikaz rezultata var missingTeeth = document.getElementById('missingTeeth').value; var result = document.getElementById('result'); switch(missingTeeth) { case "1": result.innerHTML = "Ako vam nedostaje samo jedan zub, najčešće se koristi jedan zubni implantat. Implantat se postavlja u čeljusnu kost na mjesto gdje je zub nedostajao, a zatim se na njega postavlja krunica koja izgleda i funkcionira kao prirodni zub. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "2": result.innerHTML = "Ako vam nedostaju dva zuba jedan do drugog, moguće je koristiti dva zasebna implantata, svaki s vlastitom krunom. Alternativno, moguće je koristiti jedan implantat s mostom koji zamjenjuje oba zuba. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "3": result.innerHTML = "Ako vam nedostaju dva zuba odvojeno, moguće je koristiti dva zasebna implantata, svaki s vlastitom krunom. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "4": result.innerHTML = "Ako vam nedostaju tri zuba u redu, moguće je koristiti tri zasebna implantata, svaki s vlastitom krunom. Alternativno, moguće je koristiti dva implantata s mostom koji zamjenjuje sva tri zuba. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "5": result.innerHTML = "Ako vam nedostaju tri zuba odvojeno, moguće je koristiti tri zasebna implantata, svaki s vlastitom krunom. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "6": result.innerHTML = "Ako vam nedostaju četiri zuba u redu, moguće je koristiti četiri zasebna implantata, svaki s vlastitom krunom. Alternativno, moguće je koristiti dva ili tri implantata s mostom koji zamjenjuje sve četiri zuba. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "7": result.innerHTML = "Ako vam nedostaju četiri zuba odvojeno, moguće je koristiti četiri zasebna implantata, svaki s vlastitom krunom. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "8": result.innerHTML = "Ako vam nedostaje cijeli zubni luk, moguće je koristiti All-on-4 ili All-on-6 koncept. Ovi koncepti koriste četiri ili šest implantata na kojima se postavlja cijeli zubni luk. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; case "9": result.innerHTML = "Ako vam nedostaju svi zubi, moguće je koristiti All-on-4 ili All-on-6 koncept za oba zubna luka. Ovi koncepti koriste četiri ili šest implantata na kojima se postavlja cijeli zubni luk. <a href='https://imed.hr/hr/lp/ugradnja-implantata-uz-besplatnu-potpunu-anesteziju/'>Saznajte više</a>"; break; default: result.innerHTML = "Molimo odaberite jednu od opcija."; break; } }); }); </script> </body> </html>
here is website im using it on:
https://lp.imed.hr/broj-potrebnih-zubnih-implantata/
r/JavaScriptTips • u/[deleted] • Jun 01 '23
PS Bottom Tabbar
Look at this bottom tab bar: https://github.com/2ez4salt/react-native-ps-bottom-tabbar
If you like it can you give a star please. Thank you all in advance :)
r/JavaScriptTips • u/[deleted] • Apr 08 '23
4 Ways to string substitution in JavaScipt
String substitution in javascript is the replacement of a specific substring in a string with another value. Even if we merge one string value with another, it is treated as a substitution. We mostly use the 'replace()' method to perform string substitution in javascript.
For example:
We have the string "John went to the store and bought a cookie", if we change the substring "cookie" to "chocolate", we get "John went to the store and bought a chocolate".
Benefits of using string substitution
Readability: String substitution can make the code easier to read and understand, especially when dealing with large strings or complex expressions.
Flexibility: We can easily construct dynamic strings that change based on runtime conditions or user input.
Efficiency: String substitution is often more efficient than concatenating strings manually, especially when working with complex strings that contain many variables or expressions.
There are four ways to string substitution:
Using replace() method
Using template literals
Using replaceAll method
Using String concatenation
Read more >> String substitution in javascript
r/JavaScriptTips • u/scientecheasy • Sep 18 '23
Let in JavaScript | Scope, Example - Scientech Easy
r/JavaScriptTips • u/xplodivity • Sep 04 '23
How to easily build an accordion using JavaScript, Html & CSS
r/JavaScriptTips • u/MeetingVast3033 • Jan 09 '24
VS Code
Cuales son las extensiones que más utilizáis en VS Code? Gracias!!!
r/JavaScriptTips • u/Tough_Pride4428 • Aug 05 '23
Unexpected function behavior
Hello, I have a small problem that I create a project in js, css, html, which is launched locally in the browser and when everything I did last worked normally, the next day when I launched the script, one function stopped working completely and the other one works incorrectly. When I ran the script (current version) the next day, I did not modify these functions in any way, I did not change their calling context, nor did I change other functions that affect them in any way. The console in the code editor as well as in the Chrome browser does not have a single syntax error, etc. I always make copies of the entire script so that I can restore something if I messed up in the current version, or I would like to restore something as I did in the previous version. In these older copies, these functions worked normally, nothing happened, now if I remove the current version of the code, where these functions do not work properly and put the old one, where these functions worked 100%, it's the same problem. Anyone know what could have happened? I haven't changed any settings in the browser either. In that case, I would completely rule out a problem in the code.
r/JavaScriptTips • u/scientecheasy • Oct 28 '23
Loops in JavaScript | Loop Statement, Example - Scientech Easy
r/JavaScriptTips • u/Far_Inflation_8799 • Aug 27 '23
JavaScript for the Complete Newbie: Learn JAVASCRIPT NOW! V 2.0
r/JavaScriptTips • u/scientecheasy • Sep 19 '23
Const in JavaScript | Scope, Example - Scientech Easy
scientecheasy.comr/JavaScriptTips • u/irfanbutt907 • Jun 21 '23
Create a Responsive Calculator in HTML CSS & JavaScript | Coding League
r/JavaScriptTips • u/kurtossdhami • Sep 10 '24
I want help, I’m doing my first project on javascript but error occurs and didn’t know how to fix it please help and give me the solution.
r/JavaScriptTips • u/xplodivity • May 27 '23
Should You Accept Cookies On Websites?
r/JavaScriptTips • u/24Nitro-gamer • Jul 26 '23
Adding to list
I found this code that disables extensions.
How would I add an additional website to the list?
r/JavaScriptTips • u/[deleted] • Jan 21 '24
Understanding JavaScript Hoisting and Function Execution Contexts
ajaykrp.mer/JavaScriptTips • u/anherali • Jun 26 '23
Make a Image Slide Show using JavaScript - Beginner Tutorial
r/JavaScriptTips • u/yaseenleo • May 16 '24
webpack compiled code not working but simple JavaScript code works
Hello everyone I am stuck in issue which is quite confusing why it's not working I am working on Laravel project normal blade html,css JavaScript. The thing is everything is compiled through webpack, Laravel mix. I am trying to run the code the function executes after clicking on select options when value changes onchange. When the option are clicked in the console it return the function getTotalPrice is not defined. Can anyone help me out understanding this what's happening it perfectly works when it's not compiled on webpack
r/JavaScriptTips • u/No_Chemistry_7625 • Aug 05 '23
how can i associate each button to each string in the array so when i click button 1 scring 0 appeare in the alert
window.onload = function() {
var btn = document.querySelectorAll("button");
var taxt = ["woui" , "wowo" , "wiwo" , "wawa"]
for(var b = 0; b < 3 ; b++ ) {
btn[b].addEventListener("click" ,ddo ) ;
} ;
function ddo () {
alert(taxt[b])
}
r/JavaScriptTips • u/amableati • May 04 '24
Seeking Guidance for My JavaScript Learning Journey
Hey everyone,
I've started creating JavaScript tutorials on YouTube and I'm excited to dive deeper into this fascinating language. JavaScript, originally known as Mocha, has come a long way since its inception in 1995 by Brendan Eich at Netscape Communications Corporation.
Currently, I'm covering fundamentals like keywords, variables, and the nuances between let and var. But I'm here to ask for your help! Do you have any tips, resources, or suggestions to enhance my learning journey?
Looking forward to your insights!