Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-10-2012, 08:18 PM   PM User | #1
jon22
New Coder

 
Join Date: Sep 2009
Posts: 20
Thanks: 2
Thanked 0 Times in 0 Posts
jon22 is an unknown quantity at this point
how to add unique classes to a div

basically my end goal is to hide a voucher code then reveal when clicked and open the url in a new window,

my first problem is the way the site is coded, i can't use a single jquery function because all of the instances will have the same ID/Class, so the action will cause all of the divs to reveal no matter which one is clicked.

so i need to give each div id a unique class,

here is my code:

Code:
<script>
	 $("#revealVoucher").click(function () {
    $("#voucherCode").show("slow");
    });
</script>
Code:
<div id="revealVoucher" >
    <a href="<?=$affiliate_url?>" target="_blank">Reveal Code</a>
</div>

<div id="voucherCode">
    <a href="<?=$affiliate_url?>"><?=$voucher_code?></a>
</div>
this would be perfect if each instance of this code could be given a unique class and this is where i am stuck, how could I give both ID's (revealVoucher / voucherCode) these classes, eg revealVoucher_01, revealVoucher_02 in order for them to work independently?
jon22 is offline   Reply With Quote
Reply

Bookmarks

Tags
class, div, multiple, php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:42 AM.


Advertisement
Log in to turn off these ads.