如何将data-id传递给bootstrap模式?

时间:2014-11-11 01:52:11

标签: twitter-bootstrap-3

file index.html

<div class="button-edit"><button type="button" data-toggle="modal" data-target=".addNewProduct" class="edit" data-id="107"><i class="fa fa-edit"></i>

我有以下HTML代码(我正在使用Bootstrap Twitter Modal):

<div tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true" style="display: none;" class="modal fade addNewProduct">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<form action="#" method="post" onsubmit="return false">
<div class="modal-header">
    <button type="button" data-dismiss="modal" aria-hidden="true" class="close close-product-modal">×</button>
    <h4 id="myLargeModalLabel" class="modal-title">Edit Group</h4>
</div>
<div class="modal-body">
<div class="form-horizontal col-lg-6 col-sm-6 col-xs-12">
<fieldset class="product-info">
<div class="form-group">
    <label for="product-id" class="col-md-4 control-label">Group Name *</label>
    <div class="col-md-8 input">
        <input id="product-id" placeholder="<?php echo $this->Item['group_name']?>" type="text" class="form-control"/>
    </div>
</div>
..........

我希望单击该按钮,在启动模式打开后,会出现带有'data-id'值的警报。 你能救我吗?

0 个答案:

没有答案