JavaScript/jQuery Chaining Tag Replacement Calls
<p>I'm having trouble having the 2nd call to .replaceWith overwrite the old content written with .replaceWith. How do you handle an issue like below :</p>

<pre><code>if (data==-3){  
       $('message').replaceWith('ffgd');                                        
} else if (data==-4){
       $('message').replaceWith('dfdsfdsfds');
</code></pre>

<p>On the first call when data is -3, I see ffgd. Then when a 2nd call occurs and data=-4, I know that the else if block is run because of console.log messages but it doesnt overwrite the ffgd.</p>
