Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>While I like Adam's answer, I would add a bit to it.</p> <p>Since, you probably want to return the div's contents back to the original after you leave:</p> <pre><code>var temp = $("#large-div").html(); $("#small-div").hover(function(){ $("#large-div").html($(this).html()); }, function(){ $("#large-div").html(temp) }); </code></pre> <p><strong>Edit:</strong> Based on the added code from the poster. First, change your tags to close properly:</p> <pre><code>&lt;div id="container"&gt; &lt;div id="header"&gt; &lt;div id="hcontainer"&gt; &lt;h1&gt;Test1&lt;/h1&gt; &lt;ul&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="bcontainer"&gt; &lt;div class="first"&gt; &lt;h2&gt;Test2&lt;/h2&gt; &lt;ul&gt; &lt;li&gt;4&lt;/li&gt; &lt;li&gt;5&lt;/li&gt; &lt;li&gt;6&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Next, you can add this code:</p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // The content div is passed in as a string jQuery Selector "#bcontainer" // The div to Replace is passed in as string jQuery Selector "#hcontainer" function replaceOnHover(contentDiv, divToReplace){ var temp; $(contentDiv).hover(function(){ temp = $(divToReplace).html(); $(divToReplace).html($(this).html()); }, function(){ $(divToReplace).html(temp) }); }; &lt;/script&gt; </code></pre> <p>As I don't know which div is which based on your question, here's a way to show it using this page:<br><br> If you're using a browser with a console or FireBug:<br> hit F12<br> Paste the function contained in my script tag and hit run (or enter in most cases).<br> Then, call with replaceOnHover("#question-header", "#question");<br> When you hover over the question header "regarding div and jquery," the text of your question will change to the same as the header, and as you stop hovering it will change back.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload