I asked the wrong question here, so I’ll try to ask it differently. I would like to create a page navigation using javascript and Data-filter.
In the html code, the data-filter works perfectly, but when used in javascript, the Data-filter function only runs once when the TEST link is clicked. After another click, the function will no longer start.
So how should I modify the code (if possible) so that the Data-filter works outside of javascript? I would like to preserve the structure of the js code.
Text += `<a href="#" class="number" data-filter=".text" onClick="test(1, 1)">Test</a>`;
<div class="text">Text</div>
<div class="text1">Text</div>
<script>
function test(test1, test2) {
let Text = "";
Text += `<a href="#" class="number" data-filter=".text" onClick="test(1, 1)">Test</a> `;
Text += ` <a href="#" class="number" data-filter=".text1" onClick="test(1, 1)">Test1</a>`;
code.innerHTML = Text;
}