Uncaught ReferenceError rbi is not defined at HTMLInputElement onclick

0 votes

why i am getting this type of error in my code Essix.html:10 Uncaught ReferenceError: rbi is not defined
    at HTMLInputElement.onclick (Essix.html:10)

Essix.js

function rbi(){

    var arr=[1,2,3,4,5,6];

    for(let i=1;i<=arr.length;++i){

   // console.log(arr[i]);

   document.write(arr[i]);

}

}

rbi();

Essix.html

<!DOCTYPE html>

<html>

    <head>

        <title>This is ES6 Tutorial</title>

        <script type="text/script" src="Essix.js"></script>

    </head>

    <body>

      <h1>Welcome</h1>

      <form>

          <input type="button"  value="submit"  onclick="rbi()"/>

      </form>

    </body>

</html>
Nov 2, 2020 in HTML by Edureka
• 120 points

edited Nov 2, 2020 by Niroj 838 views

1 answer to this question.

0 votes

Hello,

Just exclude the line rbi() and try once.

If this doesn't work try to define the fuction in html file and make it dry run. If it works then there is error in your calling a function using external JavaScript file.

For your reference you can see example here:https://www.javatpoint.com/how-to-call-javascript-function-in-html#:~:text=To%20invoke%20this%20function%20in,by%20clicking%20on%20the%20button.

Hope it helps!!

Thank you!!

answered Nov 2, 2020 by Niroj
• 82,540 points

Related Questions In HTML

0 votes
1 answer

How to store an array in localstorage?

Localstorage only supports Strings. So you can ...READ MORE

answered Jul 1, 2019 in Others by sunshine
• 1,280 points
10,981 views
0 votes
1 answer
0 votes
0 answers

Anyone can help me out to understand the semantic of (document.getElementBYId("demo").innerHTML="Hello") ?

Hello guys, Can Someone helps me to find ...READ MORE

Jan 17, 2020 in Web Development by anonymous
• 37,480 points
133 views
+1 vote
1 answer

What is the relationship between angularjs Scope with controller/view?

Let us consider the below block: <div ng-controller="emp"> ...READ MORE

answered Jan 20, 2020 in Web Development by Niroj
• 82,540 points

edited Jan 21, 2020 by Niroj 184 views
0 votes
1 answer

What is Html Web storage

With web storage, web applications can store ...READ MORE

answered Jan 31, 2020 in HTML by Niroj
• 82,540 points
184 views
+5 votes
2 answers

Error:Uncaught ReferenceError: is not defined at HTMLAnchorElement.onclick

The most common reason behind the error ...READ MORE

answered Dec 13, 2020 in Laravel by Gitika
• 65,850 points
19,014 views
0 votes
1 answer

Uncaught ReferenceError: web3 is not defined at window.onload

I think the onload is giving the issue. Try this ...READ MORE

answered Sep 28, 2018 in Blockchain by slayer
• 29,300 points
866 views
0 votes
1 answer

Uncaught ReferenceError:Karma: jQuery is not defined

Hii @kartik, You first have to load jQuery ...READ MORE

answered May 12, 2020 in JQuery by Niroj
• 82,540 points
1,303 views
+1 vote
2 answers

Integrating web3 from Metamask: "ReferenceError: window is not defined" error

You can't use MetaMask on server-side because ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 69,130 points
1,608 views
0 votes
1 answer

ReferenceError: primordials is not defined in node

Hello @kartik, Use following commands and install node v11.15.0: npm ...READ MORE

answered Jul 12, 2020 in Node-js by Niroj
• 82,540 points
3,780 views