typeface.js
User / Developer Forum
update text in typeface header via javascript
Tim
|
3 Feb 2010 14:41
I have a section with the id="text1" that I want to be able to update from a form input.

typeface works great when I first load the page, but I'm trying to set it up so that as you type in an input field, javascript updates the header and typeface converts it to the correct font. I have the first two steps working fine but it reverts to Times New Roman when updated.

Anyone tried this before? Any ideas on how to get it to work? I think typeface needs to reread the html or something but I'm not exactly sure how it operates.

//Input Field
<input type=text id="text1" name="text1" onchange="preview()" value="SomeText" />

<span id="d-text1" class="typeface-js smallbox">SomeText</span>

<script>
function preview(){
text1=document.getElementById("text1").value;
document.getElementById("d-text1").innerHTML=text1;
}
</script>
Dan
|
12 Apr 2010 6:26
I have the same problem. Does anyone have a solution?
Brett
|
30 Apr 2010 5:39
After you set your text, call

        _typeface_js.renderDocument();

Beware, if you have lots of typeface rendering, you'll be re-rendering it all, so there will be a perf hit.
Post a Reply
YOUR NAME
YOUR COMMENT
We don't support HTML, but please use [quote] ... [/quote] tags around quotes.