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 13,333 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.

Hope it helps!!

Thank you!!
answered Nov 2, 2020 by Niroj
• 82,880 points

Related Questions In HTML

0 votes
0 answers

Inputting a default image in case the src attribute of an html <img> is not valid?

Is there any way to render a ...READ MORE

Jul 8, 2022 in HTML by Tejashwini
• 3,820 points
371 views
0 votes
0 answers

Inputting a default image in case the src attribute of an html <img> is not valid?

In the event that the src property ...READ MORE

Jul 12, 2022 in HTML by Ashwini
• 5,430 points
261 views
0 votes
0 answers

CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page

I have the following page, which contains ...READ MORE

Jul 19, 2022 in HTML by Tejashwini
• 3,820 points
810 views
0 votes
0 answers

PHP - If variable is not empty, echo some html code

If a variable is not empty, I ...READ MORE

Jul 24, 2022 in HTML by Ashwini
• 5,430 points
818 views
0 votes
0 answers

HTML if image is not found

In an HTML page, I have an ...READ MORE

Jul 26, 2022 in HTML by Tejashwini
• 3,820 points
311 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,300 points
22,438 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
751 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,880 points

edited Jan 21, 2020 by Niroj 814 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,880 points
1,361 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP