当用户单击图像时,如何显示此图像和.titleclass.subtitleclass.description

mw3dktmi  于 2021-09-13  发布在  Java
关注(0)|答案(1)|浏览(316)
<?php while($galleryvalidate = mysqli_fetch_array($getresultgallery)){ ?>
  <div class="col-lg-2 col-md-2 mb-4 mb-lg-0" id="imageidback">

        <img
          data-id ="<?php echo $galleryvalidate['publishid']; ?>"
          src="<?php echo $folder.$galleryvalidate['publishimage']; ?>"
          class="w-100 shadow-1-strong rounded mb-4"
          alt=""
          style="cursor:pointer;"

          name="imagequery"

        />
        <input type="hidden" class="titleclass" name="titlename" id="titlenameid" value="<?php echo $galleryvalidate['title'] ?>">
        <input type="hidden" class="subtitleclass" name="subtitlename" id="subtitlenameid" value="<?php echo $galleryvalidate['subtitle'] ?>">
        <input type="hidden" class="descriptionclass" name="descriptionname" id="descriptionnameid" value="<?php echo $galleryvalidate['description'] ?>">

      </div>
    <?php } ?>

注意:该图像是php脚本中的循环函数。请帮助它3天了,我正在考虑这个问题,但仍然在查找源代码:(

6qfn3psc

6qfn3psc1#

我假设您希望将隐藏的文本元素转换为可编辑的文本元素。

$(document).ready(function() {
  $('img.imgquery').click(function() {
    $(this).closest('div').find('input[type=hidden]').attr('type', 'text');
  })
})
div input {
  display: block;
  margin-top: 5px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col-lg-2 col-md-2 mb-4 mb-lg-0" id="imageidback">

  <img data-id="<?php echo $galleryvalidate['publishid']; ?>" src="https://picsum.photos/200/300" class="w-100 shadow-1-strong rounded mb-4 imgquery" alt="" style="cursor:pointer;" name="imagequery" />

  <input type="hidden" class="titleclass" name="titlename" id="titlenameid" value="<?php echo $galleryvalidate['title'] ?>">
  <input type="hidden" class="subtitleclass" name="subtitlename" id="subtitlenameid" value="<?php echo $galleryvalidate['subtitle'] ?>">
  <input type="hidden" class="descriptionclass" name="descriptionname" id="descriptionnameid" value="<?php echo $galleryvalidate['description'] ?>">

</div>

相关问题