javascript - replaceWith(); JQuery function -


i'm trying include should simple jquery snippet friend's portfolio website replace:

<div class="content one"> <h3>content title</h3> <p>body text.</p> </div> 

with:

<div class="content two"> <h3>content title</h3> <p>body text.</p> </div> 

when hovering on separate div class of:

<div class="item two"><!--content 2 icon--> <img src="" alt="" /> </div> 

i have these separate classes of <div class="item"> have icons in them. want able hover on icon's class , replace <div class="content"> class 1 corresponds <div class="item"> icon.

for jq, i'm using following:

<script type="text/javascript"> $('.item two').hover(function(){ $('.content one').replacewith($('.content two')); }); </script> 

i have each content class (except .content one) display: none; think need throw in .show(); event inside of replacewith(); function, if remove display: none; on classes, nothing replaces class i'm trying replace.

i'm still relatively new jquery , javascript whole, it's stupid simple i'm not doing right. forgive me if didn't include enough information figure out issue. help!

try this:

$('.item.two').hover(function(){     $('.content.one').replacewith($('.content.two')); }); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -