jQuery中的Bootstrap模式更改文本

时间:2017-05-03 17:24:41

标签: javascript jquery twitter-bootstrap bootstrap-modal

好的,我已经搜索并尝试了几种方法但没有工作。

我有一个带有表单的模态和一个选择选项表单。我也有正常的纯文本,我想在jQuery中更改。

这是我的代码:

<!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="exampleModalLabel"> <center> Kupovina online </center></h4>
          </div>
          <div class="modal-body">
            <form>
              <div class="form-group">
                <label for="recipient-name" class="control-label">Ime i Prezime:</label>
                <input type="text" class="form-control" id="recipient-name">
              </div>
              <div class="form-group">
                <label for="message-text" class="control-label">Adresa:</label>
                <textarea class="form-control" id="message-text"></textarea>
              </div>

              <div class="form-group">
                <label for="message-text" class="control-label">Telefon:</label>
                <div id="thisIsanID"> <p> THIS TEXT NEEDS TO CHANGE </p> </div>
              </div>

              <label for="paketizaberi" class="control-label">Paket:</label>
              <select class="form-control" id="paketizaberi">
                <option value="PaketZvezda">Zvezda</option>
                <option value="PaketSunce">Sunce</option>
                <option value="PaketGalaksija">Galaksija</option>
              </select>
            </form>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">Otkaži</button>
            <button type="button" class="btn btn-primary" action="Update.php">Naruči</button>
          </div>
        </div>
      </div>
    </div>

在我的jQuery中,我尝试过:

$('#thisIsanID').find('p').html('Changed Text !!!!!'); 

(单击按钮并选择选项时调用此方法)

我错过了什么?

1 个答案:

答案 0 :(得分:-1)

在脚本上添加jquery.min文件

&#13;
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
&#13;
&#13;
&#13;