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 6,038 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,680 points

Related Questions In HTML

0 votes
0 answers

Is HTML case sensitive?

Would <!doctype html> or <!DocType Html> work ...READ MORE

May 9 in HTML by Kichu
• 16,850 points
13 views
0 votes
0 answers

What is &amp used for

Is there any difference in the behavior ...READ MORE

May 17 in HTML by Kichu
• 16,850 points
4 views
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
18,009 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,510 points
357 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,680 points

edited Jan 21, 2020 by Niroj 368 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,680 points
676 views
+6 votes
2 answers

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

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

answered Dec 14, 2020 in Laravel by Gitika
• 65,850 points
43,128 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,310 points
1,489 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,680 points
2,737 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP