Tag: bootstrap modal

在实施CKEDITOR时,通过id查找textarea不再有效

我有一个信息表,允许用户编辑它。 在一个单元格中,有文本信息。 如果用户单击该单元格,则会出现一个bootstrap模式,其中包含一个包含从数据库中检索的当前文本的textarea。 这是表格的一部分: Event Notes @foreach($events as $event) {{$event->Event}} id}}”>{{$event->notes}} @endforeach 这是javascript启动模式的一部分: $(‘[id^=”notes”]’).on(“click”, function(){ var input_id = $(this).attr(‘id’); var previousValue = $(‘#’+input_id).html(); console.log(‘clicked! The current notes are: ‘+previousValue); var result = input_id.split(‘-‘); var notes_id = result[1]; console.log(‘The event id selected is: ‘+notes_id); /*Open a modal*/ $(‘#modal-notes’).modal(‘show’); $(‘#modal-notes’).on(‘shown.bs.modal’, function() { console.log(‘Modal has been opened.’); $(this).find(‘#observations’).text(previousValue); […]

如何根据模态中单击的按钮发送参数?

演示和完整代码是这样的: https : //jsfiddle.net/oscar11/o5qn5gum/5/ 我的HTML代码是这样的: Click Me Close 我的Javascript代码是这样的: $(document).ready(function(){ $(“button”).click(function(){ $.ajax({ //type: ‘POST’, //url: ‘script.php’, success: function(data) { // alert(data); // $(“p”).text(data); var priceModal1 = ‘[{“@attributes”:{“Code”:”SGL”,”Total”:”200000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”200000″}},{“@attributes”:{“Code”:”DBL”,”Total”:”200000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”200000″}}]’; var priceModal2 = ‘[{“@attributes”:{“Code”:”SGL”,”Total”:”225000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”225000″}},{“@attributes”:{“Code”:”DBL”,”Total”:”225000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”225000″}}]’; var priceModal3 = ‘[{“@attributes”:{“Code”:”SGL”,”Total”:”410000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”410000″}},{“@attributes”:{“Code”:”DBL”,”Total”:”410000″},”DayPrice”:{“Date”:”2016-05-26″,”Rate”:”410000″}}]’; var isitable = ”; isitable += ‘Test get parameter json array 1’; isitable += ‘Test get parameter json array 2’; […]

点击链接时关闭模式除外

按照这些说明做我需要的但是如果我想除了/预先遵循这个规则的某些模态? $(“.modal a”).click(function(){ $(this).closest(“.modal”).modal(“hide”);});

使用Ajax将图像发送到数据库(php)而无需重新加载

我创建了一个bootstrap模式弹出窗体,在图库页面中添加图片,我开发了php和ajax代码,因为我想在这里没有页面重新加载: – 问题是,当我想将图像发送到数据库时,我显示此错误 Notice: Undefined index: photo in …. 我无法发送图片。 这是我的ajax代码 $(function() { //twitter bootstrap script $(“button#submit”).click(function(){ $.ajax({ type: “POST”, url: “image.php”, data: $(‘form.contact’).serialize(), success: function(msg){ $(“#thanks”).html(msg) $(“#myModal”).modal(‘hide’); }, error: function(){ alert(“failure”); } }); }); }); 这是Image.php文件 include ‘db.php’; if(isset($_POST[‘titre’])){ $titre = strip_tags($_POST[‘titre’]); $image_name = $_FILES[‘photo’][‘name’]; $image_tmp = $_FILES[‘photo’][‘tmp_name’]; $image_size = $_FILES[‘photo’][‘size’]; $image_ext = pathinfo($image_name, […]

如何在选择链接(内部或外部)时关闭模式对话框,如何设置一个或多个例外?

每次访问者选择一个链接时,我希望对话框消失,页面向下滚动到特定的 – 选择的ID(没有刷新)。 当然,我也必须设置一些例外! Title Text link A link B link C

在jQuery for Bootstrap iframe模式中提取发件人信息

我试图在Bootstrap 4.0 Beta中以模态显示Google Map。 我发现这篇文章和代码有效,但我在jQuery中不能“流利”地用Javascript做我需要做的事情。 我也在这里看看如何找到发送者,但我无法弄明白。 假设我的声明如下: Graceland Directions ……在我的 ,我设置了基本模态… × 我找到了这个答案,这正是我想要做的,但地址硬编码到示例中: // Bootstrap modal Google Map $(‘#google-map-modal’).on(‘shown.bs.modal’, (function() { console.log(“something happened”); var mapIsAdded = false; return function() { if (!mapIsAdded) { $(‘.modal-body’).html(‘Test’); mapIsAdded = true; } }; })()); // Bootstrap modal Google Map $(‘#google-map-modal’).on(‘shown.bs.modal’, (function() { console.log(“something happened”); var mapIsAdded = false; return […]

动态数据在添加时消失

我有一个表单来添加外部用户,其中默认情况下其中两个字段不是必需的。 但是,只有在填写其中一个字段时,它们才成为强制性的。 单击“应用”按钮时,我的表单内容将用于生成动态div,该div将附加到“div.container”。 然而,它一旦添加就会消失。 可能是什么原因呢? 这是代码: var currentPageNo = 0; // Keep track of currently displayed page // Select button that is descendant of userList $(‘#userList .prev-btn’).click(function(){ userList(currentPageNo-10); }); $(‘#userList .next-btn’).click(function(){ userList(currentPageNo+10); }); $(‘#adminList .prev-btn’).click(function(){ adminList(currentPageNo-10); }); $(‘#adminList .next-btn’).click(function(){ adminList(currentPageNo+10); }); function userList(pageNo) { var resType=”userList”; createTable(resType,pageNo); } function adminList(pageNo) { var resType=”adminList”; createTable(resType,pageNo); } […]

在Bootstrap模式确认按钮上单击,创建并下载文件jquery或knockout js

我有一个bootstrap模式(bootbox),在其上确认操作,我想创建一个包含一些数字的文件,并将文件下载为文本文件。 我已经提到在内存中创建一个文件供用户下载,而不是通过服务器,但在我的情况下它没有帮助。 这是代码: bootbox.confirm(“Item not found! Do you want to download the text file?”, (yes) => { var items = response.itemNumbers; this.href = “data:text/plain;charset=UTF-8,” + encodeURIComponent(items); }); 我也试过这个: bootbox.confirm(“item not found! Do you want to download the text file?”, (yes) => { var itemNumbers = response.itemNumbers; var textFile = null; var data = new Blob([itemNumbers], […]

将data- *传递给bootstrap Modal

我已经看到了将数据传递给模态的许多搜索结果,所有搜索结果都可能有效,但有不同的解决方案。 我有一个MySql DB,有一个非常简单的单个表。 我使用PHP echo将数据回显到HTML表。 最后的 是用于触发模态的引导按钮。 我无法获得包含的代码来显示模式中的行数据。 在我学习的时候,这里有很多评论。 Website | Login <!–Lead Number–> First Name Last Name Moving Date eMail Phone From To Moving Size <!–IP Address–> <!–Source–> Submission Time Actions <?php while($row=mysqli_fetch_assoc($result)) { echo "”; /*echo “” . $row[“lead_id”] .””;*/ echo “” . $row[“customer_first_name”] .””; echo “” . $row[“customer_last_name”] .””; echo “” . […]

即使表中没有选择,警报也会弹出

我有一个bootstrap模式,其中包含一个用户表。 我可以从表格中选择一个用户,点击“保存”后,会显示所选用户的详细信息,并收到一条提示“数据已成功保存!”的提醒。 警报位于我的代码中’saveData()’方法的末尾。 但是,即使从表中没有选择任何行,当我单击“保存”时,仍然会收到相同的警报“数据已成功保存!”。 如何确保仅在添加所选使用的详细信息时才显示警报? var currentPageNo = 0; // Keep track of currently displayed page // Select button that is descendant of userList $(‘#userList .prev-btn’).click(function(){ userList(currentPageNo-10); }); $(‘#userList .next-btn’).click(function(){ userList(currentPageNo+10); }); $(‘#adminList .prev-btn’).click(function(){ adminList(currentPageNo-10); }); $(‘#adminList .next-btn’).click(function(){ adminList(currentPageNo+10); }); function userList(pageNo) { var resType=”userList”; createTable(resType,pageNo); } function adminList(pageNo) { var resType=”adminList”; createTable(resType,pageNo); } function […]