[英]mootools html and css maniplation help
我有以下HTML
<div class="goto_step3">
<a href="<?= $this->sitePfx ?>/cart/paypal/" id="js_checkout_now" class="arrow">Checkout & 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; ?>
在.discountCode
我希望mootools使.discountCode
display:none
以及.goto_step3 p
display:none
,單擊鏈接時我希望display:none
成為display:block
任何幫助都會很棒
這應該將dom上的元素隱藏起來,並在單擊鏈接時使其可見。
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');
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.