I need to replace part of the text, for example. mustache var {{myvar}}, on an already loaded page. Html example:
<html> <head> <title>{{MYTITLE}}</title> </head> <body> <p><strong><ul><li>text {{TEXT}}</li></ul></strong></p> {{ANOTHER}} </body> </html>
What is the problem? Use $(html).html(myrenderscript($(html).html())) !
It is ugly, slow and casts <script> tags.
What you need?
I want to get the closest tag with {{}}, and not render and replace.
Your research?
First, I tried: $('html :contains("{{")) . But it returns <title>, <p>, <strong> .... But I need <title> and <li> .
How did I try to filter them:
$('html :contains("{{")').filter(function (i) { return $(this).find(':contains("{{")').length === 0 });
... but this WONT returns {{ANOTHER}} . And this is my dead end. Your suggestions?
source share