簡體   English   中英

如何從上一個div獲取隱藏的輸入值

[英]how to get the hidden input value from the previous div

我需要通過單擊文本“上傳個人資料照片”來獲取隱藏的輸入值。 我對這些東西很陌生。

          <div>
            <input type="hidden" value='<?php echo $list['profilePitcureID'];?>'
          name="profilePitcureID" id="profilePitcureID<?php echo $j; ?>" 
              class="profilePitcureID" /></div>
           <div id="meTwo" class="styleall" style=" cursor:pointer;font-family:Verdana, 
         Geneva, sans-serif; font-size:9px;">Click Here To Upload Profile Photo</div>

試試吧:

$('#meTwo').prev('div').find('input[type="hidden"]').val();
$('#meTwo').click(function(){
   alert( $(this).prev().find('input.profilePitcureID').val() );
   // or
   alert( $(this).prev().find('input[name="profilePitcureID"]').val() );
});

不知道這是否是您想要的,但是應該可以。

您可能還想將Pitcure更改為Picture

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM