I have a div with the text 'one' inside of it. When you hover over it, I want to change the text to 'two', and when you stop hovering over it, I want to change the text back to 'one'. I tried to do this using jQuery, but after it change into 'two', it doesn't change back to 'one' once you stop hovering over it. What am I doing wrong?
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").hover(function(){
$(this).replaceWith("two");
}, function(){
$(this).replaceWith("one");
});
});
</script>
<p>one</p>