Brad Bansner
asked on
make entire div a link?
Can I make a click anywhere inside the boundaries of a DIV a link? Thank you!
<script language="javascript" type="text/javascript">
$(function(){
$('#enclosingbox').click(function(){
window.location.href='my page.htm';
});
});
</script>
<div id="enclosingbox">
(a whole bunch of HTML code)
</div>
should be the case here...
ASKER
OK, not working though:
http://www.lifespanfitness.com/products_home_treadmills.asp
I want to be able to click the text:
Ready to use in minutes. No assembly required. Folds to 11" thin to store under a bed or in a closet. Ideal for occasional light walking.
And that links as well?
http://www.lifespanfitness.com/products_home_treadmills.asp
I want to be able to click the text:
Ready to use in minutes. No assembly required. Folds to 11" thin to store under a bed or in a closet. Ideal for occasional light walking.
And that links as well?
<script language="javascript" type="text/javascript">
$(function(){
$('#TR100_treadmill').click(function(){
window.location.href='TR100_treadmill.asp';
});
});
</script>
<div id="TR100_treadmill">
<div><img src="art/px_trans.gif" width="1" height="12" border="0" alt="" /></div>
<h5>$699</h5>
<div><img src="art/px_trans.gif" width="1" height="6" border="0" alt="" /></div>
<p>Free Shipping or<br />
Concierge Service</p>
<div><img src="art/px_trans.gif" width="120" height="1" border="0" alt="" /></div>
</div>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah, you are correct. I didn't have it enclosing the text the way I thought. Thanks for taking a look.
if you add a class to your text :
you may use (don't miss the DOT selector before class) :
<p class="class_TR100_treadmill">Ready to use in minutes. No assembly required. Folds to 11" thin to store under a bed or in a closet. Ideal for occasional light walking.</p>
you may use (don't miss the DOT selector before class) :
$('#TR100_treadmill,.class_TR100_treadmill').click(function(){
window.location.href='TR100_treadmill.asp';
});