繁体   English   中英

如何通过使用javascript或AJAX或任何其他方式单击“ A.php”页面中的复选框来隐藏“ B.php”页面中的元素

[英]How to hide element in page “B.php” by clicking a checkbox in Page “A.php” using javascript or AJAX or any other way

http://hespv.ca/solar-resources/solar-installer-tools/fr-component-generator

在第2步的该工具中,我想做的是,如果我在“页面类型A.php”的“锚点类型”中选中“超闪”,则“选择脚”应该消失了。 选择脚库伦来自页面“ B.php”。B.php的代码与A.php大致相同**#标头1#

页面“ A.php”的代码------ **

<?php
function radialAnchors($roof_id){

    require_once("conn.php");
    require_once('query.php');

    $anchors = sqlQuery("SELECT anchors.anchor_id, anchors.code, anchors.href, anchors.image_src, anchors.description
            FROM roof_types INNER JOIN anchors
            ON roof_types.roof_id = anchors.roof_type_fk
            WHERE roof_types.roof_id = $roof_id
            ORDER BY anchors.priority ASC", $conn);

    $checked = 0;
    foreach ($anchors as $anchor) {
        ?>
        <div class="row anchor-row">
            <div class="col-2-12 center">
                <div class="img-box">
                    <a href="<?php echo $anchor['href']; ?>" target="_blank">
                        <img src="<?php echo $anchor['image_src']; ?>"alt="<?php echo $anchor['code']; ?>">
                    </a>
                </div>
            </div>
            <div class="col- md-1-12 md-show sm-hide">&nbsp;</div>
            <div class="col-8-12 md-10-12 center">
                <h2><?php echo $anchor['code']; ?></h2>
                <p><?php echo $anchor['description']; ?></p>
                <p><a href="<?php echo $anchor['href']; ?>" target="_blank">Find out more</a></p>
            </div>
            <div class="col-1-12 center">
                <br><br><input type="radio" name="anchorRadios" id="anchor<?php echo $anchor['anchor_id']; ?>" value="<?php echo $anchor['anchor_id']; ?>" <?php if(!$checked++) echo 'checked'; ?>>
                <label for="anchor<?php echo $anchor['anchor_id']; ?>"></label>
            </div>
        </div>
        <?php
    }
}

?>

根据我的理解,选择ULTRA-FLASH时需要隐藏选择的脚。 您可以使用jquery做到这一点。 为您的ULTRA-FLASH编写更改监听器,以便在更改时可以完全隐藏选择的div英尺。

$(document).on('change', '#ultra-flash-id', function(){
      this.checked ?  $("#select-foot-id").hide() :  $("#select-foot-id").show();

 });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM