question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger Click Events with jQuery: Missing $ sign will still pass the test.

See original GitHub issue

I Don’t know if it is a general issue or only related to this task. if i write folling code in the exercise:

    $("#getMessage").on("click", function() {
      //alert((".message"));
      (".message").html("You clicked get Message");
    });

This test will pass, even though i should have put a dollar sign before (“message”). I found this error when I passed the test, but the message didn’t change on the mobile screen. link

Challenge Name

Issue Description

Browser Information

  • Browser Name, Version:
  • Operating System:
  • Mobile, Desktop, or Tablet:

Your Code

// If relevant, paste all of your challenge code in here

Screenshot

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
raisedadeadcommented, May 15, 2016

Oh Yes, this is an utter confusion. Sorry my bad. @raynor84 @nishant-tomer thanks.

The tests are actually correct. the instructions confused me as well.

The code from the issue description is not required at all. The below block is unnecessary.

//alert((".message"));
      (".message").html("You clicked get Message");

That’s the reason the tests do not look for it.

The below should rather be updated

Let’s make our “Get Message” button change the text of the element with the class message. Before we can do this, we need to implement a click event inside of our $(document).ready() function by adding this code:

to perhaps:

Let’s implement a click event inside of our $(document).ready() function by adding this code:

code block

Proceed to the next challenge where we will make our “Get Message” button change the text of the element with the class message.

0reactions
erictleungcommented, May 15, 2016

@nishant-tomer Yeah, the JSON and Ajax challenges need some love. But I like @raisedadead’s suggestion on the instruction changes.

Let’s implement a click event inside of our $(document).ready() function by adding this code:

code block

Then proceed to the next challenge where we will make our “Get Message” button change the text of the element with the class message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jquery 1.9.1 .trigger() not passing arguments to click-handler
It's a known issue: http://bugs.jquery.com/ticket/13353. Workaround is to use .triggerHandler() instead e.g.: $('#trigger').click(function (e) { var $test ...
Read more >
.trigger() | jQuery API Documentation
The .trigger() method can be used on jQuery collections that wrap plain JavaScript objects similar to a pub/sub mechanism; any event handlers bound...
Read more >
Lesson 1: Using JavaScript to Show an Alert
So far in this lesson, we have called the showAlert() function when the body of the web page is loaded. However, we could...
Read more >
JavaScript Event Madness! Capturing *all* events without ...
When an event is triggered on an element, say a link, any event handler that is attached to this specific element will be...
Read more >
Handling Events :: Eloquent JavaScript
At any point, an event handler can call the stopPropagation method on the event object to prevent handlers further up from receiving the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found