I want to write a custom jquery/js function for some hide/show manipulations in dialog.
If I place this in clientlibs folder[having categories String cq.authoring.dialog, dependencies String granite.jquery] which has js.txt[having name of custom js/jquery file] and the custom file.
If i just put the below
in custom file,
alert is displayed when I refresh the page and not when I open dialog. Trying on this for quite some time now, but no luck. Shouldn't ideally this alert be displayed when I open the dialog rather than on page refresh.
Also, created the clientlibs folder at component level, but still the same behavior.
Not sure what is it that I am doing wrong. Any thoughts on this will be really helpful.
This is true you will see the alert on page load because all the authoring clientLibs is loading on pageload in authoring mode.So when you load the page all client lib will load that along with your ClientLib, you can not use directly $(document).ready(function() it will show the alert when you load.you have to bind some event with that id.So it will trigger only whrn particular event occur on particular id like onclick below is the sample.