Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript AJAX Basics (retiring) jQuery and AJAX Introducing jQuery

Ben Ahlander
Ben Ahlander
7,528 Points

why is the button not hiding?

<!DOCTYPE html>
  <meta charset="utf-8">
  <title>AJAX with JavaScript</title>
  <link href='http://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
  <link rel="stylesheet" href="css/main.css">
  <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>


  function sendAJAX() {


  <div class="grid-container centered">
    <div class="grid-100">
      <div class="contained">
        <div class="grid-100">
          <div class="heading">
            <h1>Bring on the AJAX</h1>
          <button id="load" onclick="sendAJAX()" class="button">Bring it!</button>
          <div id="ajax">


3 Answers

Arien Woodrow
Arien Woodrow
7,222 Points

The button's id is load not ajax so $('#load').hide();

6,762 Points

The id of button is "load" instead of "ajax".

 $('#ajax').hide();  //change it to "load"


try to put it in a click function like this $( "ajax" ).click(function() { $( this ).hide(); });

Hope this helps : )