diff --git a/nette.ajax.js b/nette.ajax.js index 1d82532..4e74ebd 100644 --- a/nette.ajax.js +++ b/nette.ajax.js @@ -438,6 +438,8 @@ $.nette.ext('snippets', { applySnippet: function ($el, html, back) { if (!back && $el.is('[data-ajax-append]')) { $el.append(html); + } else if (!back && $el.is('[data-ajax-prepend]')) { + $el.prepend(html); } else { $el.html(html); } diff --git a/readme.md b/readme.md index 84e29ee..9e8911a 100644 --- a/readme.md +++ b/readme.md @@ -200,6 +200,10 @@ Ajaxification of element ensures, that `e.preventDefault()` will be called. This New content of snippet with this attribute won't replace the old content, but it will rather be appended to it. +### `data-ajax-prepend` (in `snippets` extension) + +New content of snippet with this attribute won't replace the old content, but it will rather be prepended to it. + ### `data-ajax-validate` (in `validation` extension) Click on link or submittion of form is validated on various conditions. You can switch any of them: