jquery exercises

jQuery: Display previous handler's return value

jQuery Fundamental - II : Exercise-93

Display previous handler's return value.

Sample solution :

HTML Code :

<!DOCTYPE html>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Display previous handler's return value</title>
<button>Display Event result</button>

JavaScript Code :

$( "button" ).click(function( event ) {
return "Hello";
$( "button" ).click(function( event ) {
$( "p" ).html( event.result );

See the Pen jquery-fundamental-exercise-93 by w3resource (@w3resource) on CodePen.

Contribute your code and comments through Disqus.

Previous: Cancel the default action (navigation) of the click.
Next: On mouseout of anchors, alert the element type being entered.

What is the difficulty level of this exercise?

New Content: Composer: Dependency manager for PHP, R Programming