mootools html 和 css 操作帮助

发布于 2024-09-03 02:08:04 字数 1185 浏览 2 评论 0原文

我在 DomReady 上有以下 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; ?>

我希望 mootools 制作 .discountCode display:none 以及 .goto_step3 p display:none< /code> ,单击链接后我希望 display:none 变为 display:block

任何帮助都会很棒

I have the following 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; ?>

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:none to become display:block

Any help would be great

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月竹挽风 2024-09-10 02:08:04

这应该隐藏 dom Ready 上的元素,并在单击链接时使它们可见。

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');
    });

});

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');
    });

});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文