S
S
stone2021-03-14 18:30:04
JavaScript
stone, 2021-03-14 18:30:04

How to fix Uncaught ReferenceError: name is not defined error?

Hello.

Encountered an error:
Uncaught ReferenceError: asd is not defined

Here is the code:
HTML

<div class="text">
   <div class="price">99.000</div>
   <div class="productName">REVO Morning</div>
   <div class="inf">đắng, hậu ngọt, hương hoa </div>
   <div class="cart-btn">
     <button class="in__cart" onclick="asd()">MUA NGAY</button>
     <a href="" class="deetails">CHI TIẾT</a>
   </div>
 </div>


typescript

function asd(){
  console.log('asd');
}


JSFiddle
https://jsfiddle.net/pypochek/9jvpz3ex/1/

Please help me understand.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Farkhad Agamoglanov, 2021-03-14
@Vladokos

<script src="script.js"></script>
You didn't include the js file in the html document.

S
stone, 2021-03-16
@Vladokos

there is also a second solution - window.asd= function asd()....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question