It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

AJS, jQuery and $

I have a code snippet like this

$(document).ready(function() {

$('.hideMessage').on('click', function () {
$('.message').hide();
});

$('.message').on('hide', function() {
alert("hided");
});

(function ($) {

var el = $.fn['hide'];
$.fn['hide'] = function () {
this.trigger('hide');
return el.apply(this, arguments);
};

})(jQuery);
});

When i run this code on a simple html page; if hide event of '.message' element called, page show an alert message contains 'hided'. But it doesnt work on velocity template. 'hide' event doesnt be called.


Template renderer doesnt include '$' chars.

1 answer

0 votes
Bryan Bojorque Community Leader Dec 19, 2019

You'd have to change the $ with AJS.$().

All the javascript libraries are packages under AJS, AFAIK.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you