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,730 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,720 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
• 19,040 points
31 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
• 19,040 points
13 views
0 votes
0 answers

Is there any Blank HTML tags?

Can someone tell me if there are ...READ MORE

May 27 in HTML by Tejashwini
• 680 points
18 views
0 votes
0 answers

Is HTML "is" attribute?

What is "is" in HTML, I have ...READ MORE

Jun 3 in HTML by Tejashwini
• 680 points
26 views
0 votes
0 answers

What is class in HTML?

what is a class in HTML, I ...READ MORE

Jun 3 in HTML by Tejashwini
• 680 points
13 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,536 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,500 points
383 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,720 points

edited Jan 21, 2020 by Niroj 392 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,720 points
714 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