簡體   English   中英

顯示行在Bootstrap中折疊了

[英]Show row collapsed in Bootstrap

$i = 0;
while($row = $statement->fetch()) {
    $current_id = 'id-' . $i;
    $i++;
    echo "
        <tr>
            <td>
                <p>
                    <button class='btn btn-primary' 
                         type='button' 
                         data-toggle='collapse' 
                         data-target='#<?=$current_id?>' 
                         aria-expanded='false' 
                         aria-controls='Collapse'>
                        Button with data-target
                    </button>
                </p>
                <div class='collapse' id='<?=$current_id?>'>
                    <div class='card card-block'>
                        Here is the content for block which will be shown when the button. This uses button with data-target attribute for collapsing.
                    </div>
                </div>
            </td>
    ";
}

我的錯誤在哪里? 它不會崩潰,但我需要為行使用唯一的ID。

現在工作了。 我現在要做的是:

 $ccid = "#$current_id";
 $ccid2 = "$current_id"; 

然后我將變量放在ID和Href中,如下所示:

href='".$ccid."'
id='".$ccid2."'

解決了這個問題。 謝謝大家!

暫無
暫無

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

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