So below i have my code example.

Basically when a user loads this page depending on the type of
"campaign" this is, I want jQuery to show the proper Sub Form Piece. I
can get the alert() outside the if else to fire, but nothing inside
the if else fires, which leads me to believe that I might have the
args set incorrectly

any help would be great

Thanks

HTML **
<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');

  $current_campaign.ready(function() {
    alert($('div.detail_campaign_type').text
());                              <-- This fires

    if ($('div.detail_campaign_type').text() == 'Coupon') {
      alert
('hello');
<-- Inside the If Else does not register
      $coupon_div.show();
      $contest_div.hide();
    }
    else if ($('div.detail_campaign_type').text() == 'Contest') {
      alert
('hello2');
<-- Neither does this
      $coupon_div.hide();
      $contest_div.show();
    }
  });
});

Reply via email to