+ 8

Why we cannot get output plz see this and fix it plz

https://code.sololearn.com/WsECJjoUefpk/?ref=app

14th Oct 2017, 12:38 PM
Arpan Kanwer
13 odpowiedzi
+ 7
https://code.sololearn.com/WENOe6YY1Bcq/?ref=app Here, I'hv fixed it. Check it out.
14th Oct 2017, 12:58 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 6
The next one you posted will work, because of that is internel script. When you add JS inside <script>...</script> You don't have to declare function; Because of that will executed automatically. But When you add JS in another file, You have to declare function. and to make sure that code run when webpage load, Use "window.onload=fucti..."
14th Oct 2017, 12:48 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 5
You have to declare function in the JS Script. Wait till. I'm fixing your code.
14th Oct 2017, 12:51 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 4
You haven't declared Function(); 😁
14th Oct 2017, 12:42 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 4
Welcome Brother 😊
14th Oct 2017, 12:50 PM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 3
but see this <!DOCTYPE html> <html> <body> <h2>The += Operator</h2> <p id="demo"></p> <script> var x = 10; x += 5; document.getElementById("demo").innerHTML = x; </script> </body> </html>
14th Oct 2017, 12:43 PM
Arpan Kanwer
+ 3
run this code
14th Oct 2017, 12:43 PM
Arpan Kanwer
+ 3
ooo thx bro
14th Oct 2017, 12:49 PM
Arpan Kanwer
+ 3
oohk
14th Oct 2017, 12:52 PM
Arpan Kanwer
+ 2
but how can we set function in paragraph tag
14th Oct 2017, 12:50 PM
Arpan Kanwer
+ 2
thx
14th Oct 2017, 12:51 PM
Arpan Kanwer
+ 2
thx fr answer to all
14th Oct 2017, 1:22 PM
Arpan Kanwer
+ 1
Because you're trying to change an element that isn't loaded yet. That means you don't have any element with "demo" id, but you're trying to change it. How to fix it? 1- Use jQuery: $(document).ready(function () { // Codes }); 2- Use onload attribute or event: https://www.w3schools.com/jsref/event_onload.asp
14th Oct 2017, 12:49 PM
$machitgarha
$machitgarha - avatar