Questions tagged [javascript]
The javascript tag has no usage guidance.
15
questions
5
votes
1
answer
2k
views
Update Commerce Cart using Ajax
Is there a way to update the cart using ajax?
I've tried something like:
$('span.quick-cart-add>p>a').click(function(e){
e.preventDefault();
var data = {};
...
2
votes
3
answers
34k
views
Can I set a JS variable to a Twig output tag?
This came out of a previous question
I need to set a variable of a tag group that I can reference in jquery for use with a plugin.
I'm declaring this variable in a tag so my included js files can ...
1
vote
1
answer
110
views
How to use multiple different instances Element API "Load More" button?
Following up on a previous question of mine:
How to skip the first few entries in a "load more" scenario with Element API?
I have a website that utilizes the "load More" (button) ...
5
votes
1
answer
4k
views
Loading javascript on specific sections/pages
What is the recommended way to add section specific javascript to entry pages?
I need to make some 3rd party api calls front end for currency conversion but I want to only use it on a specific ...
3
votes
2
answers
697
views
Access add and remove events with the Craft Element Selector?
Is there any way to access an event, and trigger some function, when an element is added / removed with the Craft Element Selector logic available in Garnish?
I am working on a custom field type and ...
2
votes
1
answer
2k
views
Can you pass a variable with includeJsFile?
Can you do something similar to using "with" in twig's include tag (http://twig.sensiolabs.org/doc/tags/include.html), but instead with includeJsFile?
I am using a plugin to filter my entries by ...
1
vote
0
answers
383
views
How can I edit multiple entries via multiple front-end forms using Vue.js?
I found this post. However, writing a plugin in currently not an option, and I'd like to do this with Vue.js since I'm already using it for form validation & other stuff. Also, this involves ...
1
vote
1
answer
179
views
Garnish event when changing category group
When I am on the categories index (admin/categories), is there a Garnish event that fires when you select a different category group in the sidebar? I want to add some custom JS after the AJAX request ...
1
vote
1
answer
155
views
Detect task is finished
Is there a way to detect when a task is finished with js, for example I have a task running I can see the progress bar in the top right corner I would like to attach an event so when the task is done ...
1
vote
1
answer
1k
views
Include Craft JS object
In the controller documentation for plugins, there's a section that talks about routing to specific actions using a Craft object like this:
var url = Craft.getActionUrl('cocktailRecipes/ingredients/...
1
vote
1
answer
128
views
How to skip the first few entries in a "load more" scenario with Element API?
I have a website that uses a "load more" button. The process for this button can be found here:
http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms
I made it ...
1
vote
2
answers
1k
views
Load More Entries Button
I am trying to make my entry loop have a load more button, and not sure how to do it. I tried the method from http://craftsnippets.com/articles/infinite-scrolling-and-lazy-loading-with-craft-cms but I ...
1
vote
1
answer
1k
views
How do I print a value from Craft/Twig into a Javascript function?
I just want to print a value from Craft into a JavaScript function to filter a dashboard.
The function is this:
showOnly(filterName, values);
I tried this:
showOnly('Short Names','{{ entry.title ...
1
vote
1
answer
173
views
Element API - UrlHelper generates backwards slashes (regex)
I am generating a url within Element API:
'profile' => UrlHelper::getUrl("directory/company/{$member->id}/{$urlslug}"),
which outputs:
http:\/\/craft.fira\/directory\/company\/1501\/abet-...
1
vote
1
answer
712
views
How reference "Craft" js object in jquery scope
I have this function within my <script> tags:
$('.btn').click(function()
{
var data = {
title: "This is a title"
};
Craft.postActionRequest('plugin/controller/action', data,...