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

时间:2017-05-19 09:12:35

标签: javascript php jquery ajax

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

在第2步的这个工具中,我想这样做,如果我在Anchor类型中检查ULTRA-FLASH是Page“A.php”那么选择脚应该消失。选择foot coulmn来自Page“B.php” B.php的代码与A.php大致相同 **#Header 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
    }
}

&GT;

1 个答案:

答案 0 :(得分:0)

根据我的理解,您需要在选择ULTRA-FLASH时隐藏选择脚。这可以使用jquery。为你的ULTRA-FLASH写改变监听器你可以完全隐藏选择foot div。

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

 });