Build a Calculator! -- Make sure the button has the exact id 'button'

non-track
build-a-calculator

#1



I get this message everytime "Make sure the button has the exact id 'button'" this is my code:
<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<link rel="stylesheet" href="style.css" />
		<script src='script.js' type="text/javascript"></script>
	   
	</head>
	<body>
	<div id="button"></div> <button type="button"> Click Me 
	</button> 
	</body>
</html>

And this is my script.js
$(document).ready(function(){
    $("button").click(function(){
    //action
    });
});


#2

This is the html and css forum, can you post the url of the exericse?


#3

https://www.codecademy.com/en/courses/web-intermediate-en-jfhjJ/0/5#


#4

You should add the id="button" to your <button>, and a id of change_me to your div


#5






</head>
<body>
<div id="change_me"></div> <button id="button" type="button"> Click Me 
</button> 
</body>

Like this then?


#6

Almost, the button should be inside the div:

<div id="change_me"><!-- button here --></div>

i haven't looked at jquery code, do i need to?


#7

I added one more thing to the jquery and it worked.


#8

So issue resolved? Good to hear :slight_smile:


#9

got a new message on a later step..

code:


	<title>Calculator</title>
</head>
<body>
<div id="calculator" 
div id="total">
<div id="operators"
<a>+</a>
<a>-</a>
<a>/</a>
<a>*</a>
<a id="equal">=</a>
>
<div id="numbers">
<a>1</a>
<a>2</a>
<a>3</a>
<a>4</a>
<a>5</a>
<a>6</a>
<a>7</a>
<a>8</a>
<a>9</a>
<a>0</a>
</div>	
</div>
</div>
</div>
</body>

message :Your number links need to be in the #numbers div!

remove head just so you can see my code.


#10

Again, exactly which exercise is this?


#11

https://www.codecademy.com/en/courses/web-intermediate-en-jfhjJ/1/4#


#12

This line:

<div id="operators"<!-- missing > here -->

the > ended up after equal:

<a id="equal">=</a>
><!-- here is your missing > -->

it seems you need to close your div#operators with a div closing tag (</div>) before your div#numbers


#13

solved!!!:grinning: thanks a lot


#14

https://www.codecademy.com/en/courses/web-intermediate-en-jfhjJ/3/3#2

Getting this error :Did you define the '.click()' correctly? Look at the hint if you need help

$(document).ready(function(){
var testNumLength = function(number) {
if (number.length > 9) {
totaldiv.text(number.substr(number.length-9,9));
if (number.length > 15) {
number = "";
totaldiv.text("Err");
}
}
};
var number = "";
var newnumber = "";
var operator = "";
var totaldiv = $("#total");
totaldiv.text("0");

//Add your .click() here!
$('#numbers a').not('#clear,#clearall').click(function(){
   number += $(this).text();
    totaldiv.text(number);
    testNumLength(number);
});

});


#15

I haven't done jquery in ages, please make a new topic so someone else can take it from here


#16

posted in javascript but no answer, might want to post it in Jquery aswell?


#17

Patient my friend, this is a forum, not a instant chat response. No, keep the forum clean, do not create multiply topics for the same question


#18

This is a known bug on our side. We'll try to fix this asap.
Sorry for the inconvenience.