hub.eb?material_id=384&track_id=426

JQuery Click Event


The click event can be bound to any control using the HTML Element Properties window.

A client-side click event is better suited to operations involving manipulating the DOM without updating the user state on the server. Such operations could include animations, changing CSS classes and using browser functionality e.g. cookies.

Steps


1

Create a form and add a Hyperlink Control with text content “add Cookie”. Create a Text Control and give it the following id: currentCookies

(n.b. Ensure that the form has jQuery attached. The bootstrap4 Presentation Template includes jQuery.)

2

Add a jQuery click event that runs the following code:

Cookies.set("name", "cookieMonster");
$("currentCookies").text(document.cookies)
3

Run the form and click the “add Cookie” hyperlink

You will see that the cookie has been added.

Current Module

Related