variables - Pass pug mixin to JavaScript -
i have common modal on site showing endnotes. wanted create quick pug mixin don't have type structure on , over.
however, don't know how pass #id js toggle_visibility function. (note, js works perfectly, i'm trying convert mixin)
mixin modal(id, content) div.modal(class= id) div.modal-content= content a.close(onclick="toggle_visibility('= id');") close here's example of pug code working (outside mixin)
div.modal#downloads-citations div.modal-content p content here show article citations a.close(onclick="toggle_visibility('downloads-citations');") close
what you're looking called 'attribute interpolation', , not directly supported anymore in current versions of pug (see this page in docs).
fortunately, however, there easy workaround, based on concatenation of strings. replace last line of code snippet statement:
a.close(onclick="toggle_visibility('" + id + "');") close
Comments
Post a Comment