开发者

mootools html and css maniplation help

开发者 https://www.devze.com 2022-12-31 08:03 出处:网络
I have the following HTML <div class=\"goto_step3\"> <a href=\"<?= $this->sitePfx ?>/cart/paypal/\" id=\"js_checkout_now\" class=\"arrow\">Checkout &amp; Pay</a>

I have the following HTML

<div class="goto_step3">
<a href="<?= $this->sitePfx ?>/cart/paypal/" id="js_checkout_now" class="arrow">Checkout &amp; Pay</a>
<? if($this->discountCodeErrorMessage): ?>
    <p class="error discountError"><?= $this->discountCodeErrorMessage ?></p>
<? endif; ?>
<div class="discountCode fncFixedHeight <?= $this->has_discount ? 'redeemed': ''; ?>">
<? if(!$this->has_discount): ?>
    <label for="inptdiscountcode">Enter discount code</label>
    <input class='fncInpDiscountCode' id="inptdiscountcode" type="text" name="discount_code" value="" />
<? else: ?>
    <? if(!(empty($this->discount['discount_message']))): ?>
    <?= $this->discount['discount_message']; ?>
    <? else: ?>
    Voucher code redeemed
    <? endif; ?>
<? endif; ?>

On DomReady I want mootools to make .discountCode display:none and also .goto_step3 p display:none , on clicking the link I want the display:开发者_StackOverflow社区none to become display:block

Any help would be great


This should hide the elements on dom ready and make them visible when the link is clicked.

window.addEvent('domready', function() {

    // you can pass multiple selectors to $$ each separated with a comma
    $$('.discountCode, .goto_step3 p').setStyle('display', 'none');

    $$('.goto_step3 a').addEvent('click', function() {
        $$('.discountCode, .goto_step3 p').setStyle('display', 'block');
    });

});
0

精彩评论

暂无评论...
验证码 换一张
取 消