I'm adding the text "I Tot I Taw a Puddy Tat!" to the top of a page with jQuery this way in the ready function:
$("#Twitterati").html("<h3>I Tot I Taw a Puddy Tat!</h3>").append(tweetiePie);
...but I want to dynamically replace that placeholder text ("I Tot I Taw a Puddy Tat!") with the contents of this text input control:
<input type="text" name="inputQuery" id="inputQuery" placeholder="Enter something" style="display: inline-block;" />
...when the Enter key is mashed. How can I do that?
I tried this:
$("#inputQuery").keyup(function(e) {
if(e.keyCode == 13) {
$("#Twitterati h3").val($("#inputQuery".val()));
}
});
...and this:
$("#inputQuery").keyup(function(e) {
if(e.keyCode == 13) {
$("#Twitterati h3").replaceWith($("#inputQuery".val()));
}
});
...but neither one did anything, that I could see...
UPDATE
This is working pretty well, now; but I want the tweets to refresh when the inputQuery val replaces the text/caption/heading, too. IOW, I can change the text from, say, "jquery" to "html5" but the tweets I've got displaying remain the jquery tweets. How can I get that div to refresh?