2011-08-14 66 views
0

我想懸停在html中創建的標題以顯示隱藏文本,但我無法弄清楚如何在jQuery中執行此操作。將懸停標題顯示爲文本

我有以下的HTML權限,我只有打印頭我想顯示包含文本的div嘿。

<fieldset class="formats"> 
    <legend>Format Interested</legend> 
    <div class="col1"> 
     <h2 class="test">Print Only</h2> 
     <div class="info"><p>Hey</p></div> 
     <input type="checkbox" name='PrintOnly[]' value='8x12' />8" x 12" - $50.00 USD<br /> 
     <input type="checkbox" name='PrintOnly[]' value='12x18' />12" x 18" - $90.00 USD<br /> 
     <input type="checkbox" name='PrintOnly[]' value='16x24' />16" x 24" - $125.00 USD<br /> 
     <input type="checkbox" name='PrintOnly[]' value='20x30' />20" x 30"- $160.00 USD 
    </div> 
    <div class="col2"> 
     <h2>Framed Prints</h2> 
     <input type="checkbox" name='FramedPrints[]' value='8x12' />8" x 12"- $175.00 USD*<br /> 
     <input type="checkbox" name='FramedPrints[]' value='12x18' />12" x 18"- $230.00 USD*<br /> 
     <input type="checkbox" name='FramedPrints[]' value='16x24' />16" x 24"- $375.00 USD*<br /> 
     <input type="checkbox" name='FramedPrints[]' value='20x30' />20" x 30"- $425.00 USD* 
     <p><em>* Frame prices can vary based on framing materials used.</em></p> 
    </div> 
    <div class="col3"> 
     <h2>Floating Gallery Wrap</h2> 
     <input type="checkbox" name='FloatingGalleryWrap[]' value='8x12' />8" x 12"- $115.00 USD<br /> 
     <input type="checkbox" name='FloatingGalleryWrap[]' value='16x24' />16" x 24"- $275.00 USD<br /> 
     <input type="checkbox" name='FloatingGalleryWrap[]' value='20x30' />20" x 30"- $360.00 USD 
    </div> 
    <div class="col4"> 
     <h2>Fine Art Canvas Print</h2> 
     <input type="checkbox" name='FineArtCanvasPrint[]' value='12x28' />12" x 28" - $200.00 USD<br /> 
     <input type="checkbox" name='FineArtCanvasPrint[]' value='16x24' />16" x 24" - $275.00 USD<br /> 
     <input type="checkbox" name='FineArtCanvasPrint[]' value='20x30' />20" x 30" - $360.00 USD 
    </div> 
</fieldset> 
<input type="hidden" name="photoid" value="<?php echo $photo['Photo']['id'];?>"/> 
<input type="hidden" name="galleryname" value="<?php echo $photo['Gallery']['name'];?>"/> 
<input type="hidden" name="photofilename" value="<?php echo $photo['Photo']['filename'];?>"/> 
<input class="buttonsend" id="ajaxformsend" type="button" value="Send Request" onclick="sendform();return false;"/><div class="cleaner"></div> 

</div> 
</form> 

回答

1

好吧,我必須給予信貸antimatterfish得到它開始,但我想我清理它是你想要的。

http://jsfiddle.net/8a8T7/

將鼠標懸停在 「僅打印」,使 「嘿」 可見

+0

是的,我只是做了你在發佈之前所做的事情,但這是正確的答案。非常感謝。 :) – Novazero

2
$('.test').hover(
function(){ $('.info').show();}, 
    function(){ $('.info').hide(); 
}); 
+0

嗯我試過這個,但它沒有做任何不幸的事情,雖然它似乎是從我研究的方向來看。 – Novazero

+0

嗯,它的工作在小提琴... http://jsfiddle.net/4FG7h/嘗試與divs玩?使用id而不是class,或者把頭部放在一個div裏面並設置jquery。不太確定問題是什麼。 – craftsycandymonster

+0

嗯,是啊不知道要麼捅了一下,看看我的答案是否適用於我的項目。謝謝,我感謝你花時間幫助我。 – Novazero