Update text content with minified.js

152 views Asked by At

What is the right way to update text of a element with minifiedjs?

E.g.

<a class="myRef">Old text</a>

I have tried logical:

$('.myRef').text('New text');

But it doesn't work.

2

There are 2 answers

1
Jan.J On BEST ANSWER

http://minifiedjs.com/docs/howto.html#html_text

$('.myRef').fill("My new text");

I get it right from documentation.

0
Scott On

You can use the fill method to replace the existing text value.

$('.myRef').fill("New Text Value");

or you can use the add method to append text to the existing text.

$('.myRef').add("Append Text");

(The text method returns the concatenated text content of all nodes in the list.)

This list of How To's is helpful for learning how to use minifiedjs.