For clarification, do you mean in regular text or in math content? (Or in a latex-image as mentioned above?)
\usepackage{txfonts}
is loading a tex package. It is not going to affect HTML (except with latex-image images, since those are actually built by LaTeX). So then using
\varheartsuit
in regular text would not do anything in HTML text except faithfully reprint "\varheartsuit". And using it in math content will lead to an error in MathJax.
If you are using XeLaTeX to build your PDF, you can use the heart character directly in your content: ♥
Although for print, you may need to ensure that the font carries this character. (If it does not, there are ways to have tex switch to a different font for a particular unicode character.)