Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 1
How to import Js libraries into SL playground?
Hello guys, Iām currently working with Js and Iād like to import a library into SL playground. How can I do it?
17 Respostas
+ 6
I don't know what libraries you have in mind, but maybe you can use CDN and link them in your project.
https://cdnjs.com/
+ 6
Of course, like any other script link. āļø
+ 5
Great, it's looking amazing.
Window.onload is not written correctly.
Put this instead of the first line:
window.onload= function() {
When I uncomment the seventh line it works fine for me.
šš
+ 4
You obviously have one extra closing braces in line 10, read the error report.
However, it seems that won't solve the issue. One more file is missing, you'll need to read the official documents and also this thread on github :
https://github.com/dwa012/html5-qrcode/issues/36
https://code.sololearn.com/WZbCZ756EC7Z/?ref=app
+ 3
Alright. I don't know what else to tell, except to try their official example maybe that will work for you :
https://davidshimjs.github.io/qrcodejs/
+ 2
Yes, that should be added too to your project. That's why you see that error.
I see a qr code ? It shows every time.
Maybe you should try this code outside sololearn.
+ 2
dĻlĻ
ŃĻlĻ
Ń are you able to see different profiles by changing the āprofile numberā input?
For example: your profile number is 2251477. Thus, once you put it into the first input the qrcode should lead to your profile page because itās sololearn.com/profile/2251477
EDIT: iāve added .toString() method in the 7th line so that the number typed in the input turns into a string. But still doesnāt work out properly. There must be an error in the 78th line
EDIT2: solved!
+ 1
hi dĻlĻ
ŃĻlĻ
Ń , thanks for answering. I need to use the qrcode.js library and implement it into the HTML code
+ 1
So i just need to type in the HTML
<script type=ātext/javascriptā src=āhttps://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.jsā></script>
Right?
+ 1
thank you dĻlĻ
ŃĻlĻ
Ń !
+ 1
https://code.sololearn.com/WO8yZOtCk7Lr/?ref=app
Canāt find out why it says āSyntax Errorā
š¤
+ 1
Thanks for your patience, i know itās annoying...
Almost finished my code, just miss the qrcode script implementation
https://code.sololearn.com/Wpw8c3rVXKa9/?ref=app
+ 1
Ok dĻlĻ
ŃĻlĻ
Ń good news, found a way to display the qrcode through JQuery!!š Now just have to solve the problem at line 64 of the Js file. That inp1 var is not recognised
0
The error is: ReferenceError: Can't find variable: QRCode at Line: 1
Got few questions. That one in the Js section is a library?
Run your code but it shows nothing, just a white background
0
Ok found that it doesnāt work on ios devices.
Then i pasted the code on Codepen (pc) to see if it works and it doesnāt. You can check it here ā>
https://codepen.io/Gintonicc/pen/EBEWev
0
The problem is that the qrcode shows just the link https/sololearn.com/profile while it should display the https:/sololearn.com/profile/ + number of the profile (which you put in the first input). Thatās like the inp1 var doesnāt work