On Sat, Jan 31, 2009 at 10:47 PM, Bob O <sngndn...@gmail.com> wrote: >
> <div class="detail_campaign_type">Coupon</div> <-- > This is the reference text that is dynamic > > <div id="campaign_create_coupon">**Html Form Piece**</div> > > <div id="campaign_create_contest ">**Html Form Piece**</div> > > $(document).ready(function() { > var $coupon_div = $('#campaign_create_coupon'); > var $contest_div = $('#campaign_create_contest'); > var $current_campaign = $('div.detail_campaign_type'); > Why the $ before your vars? This ain't PHP (I do this all the time, btw) > $current_campaign.ready(function() { > alert($('div.detail_campaign_type').text > ()); <-- This fires Though I'm sure it's unrelated to the problem, since you're assigning $('div.detail_campaign_type') to a var (current_campaign), you might as well use that. Oh, I think I see the problem. You're using a class to identify your div. Do you have any other divs with that class on the page. If so, you'll need to identify your target more clearly. If not, you should consider using an ID instead. At the minimum, try extending your if/else block with the following, just to get a handle on things: ... } else { alert($('div.detail_campaign_type').text() ); }