第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在Jquery UI對(duì)話(huà)框中實(shí)現(xiàn)“確認(rèn)”對(duì)話(huà)框?

如何在Jquery UI對(duì)話(huà)框中實(shí)現(xiàn)“確認(rèn)”對(duì)話(huà)框?

Qyouu 2019-12-06 11:06:01
我嘗試使用JQuery UI對(duì)話(huà)框替換丑陋的javascript:alert()框。在我的場(chǎng)景中,我有一個(gè)項(xiàng)目列表,在每個(gè)項(xiàng)目旁邊,我將為每個(gè)項(xiàng)目都具有一個(gè)“刪除”按鈕。偽html設(shè)置如下:<ul>    <li>ITEM <a href="url/to/remove"> <span>$itemId</span>    <li>ITEM <a href="url/to/remove"><span>$itemId</span>    <li>ITEM <a href="url/to/remove"><span>$itemId</span></ul><div id="confirmDialog">Are you sure?</div>在JQ部分中,在準(zhǔn)備好文檔后,我首先將div設(shè)置為帶有必要按鈕的模式對(duì)話(huà)框,然后將要觸發(fā)的那些“ a”設(shè)置為確認(rèn),然后將其刪除,例如:$("ul li a").click(function() {  // Show the dialog      return false; // to prevent the browser actually following the links!}好,這是問(wèn)題所在。在初始化期間,對(duì)話(huà)框?qū)⒉恢朗钦l(shuí)(項(xiàng)目)啟動(dòng)它,也不知道項(xiàng)目ID(!)。我如何設(shè)置那些確認(rèn)按鈕的行為,以便在用戶(hù)仍然選擇“是”的情況下,將通過(guò)該鏈接將其刪除?
查看完整描述

3 回答

?
慕標(biāo)5832272

TA貢獻(xiàn)1966條經(jīng)驗(yàn) 獲得超4個(gè)贊

您應(yīng)該能夠解決它。更正是在單擊事件的按鈕的對(duì)話(huà)框選項(xiàng)的設(shè)置器中。


$(document).ready(function() {


? ? $("#dialog").dialog({

? ? ? ? modal: true,

? ? ? ? bgiframe: true,

? ? ? ? width: 500,

? ? ? ? height: 200,

? ? ? ? autoOpen: false

? ? });



? ? $(".lb").click(function(e) {


? ? ? ? e.preventDefault();

? ? ? ? var theHREF = $(this).attr("href");


? ? ? ? $("#dialog").dialog('option', 'buttons', {

? ? ? ? ? ? "Confirm" : function() {

? ? ? ? ? ? ? ? window.location.href = theHREF;

? ? ? ? ? ? },

? ? ? ? ? ? "Cancel" : function() {

? ? ? ? ? ? ? ? $(this).dialog("close");

? ? ? ? ? ? }

? ? ? ? });


? ? ? ? $("#dialog").dialog("open");


? ? });


});

希望這對(duì)其他人有所幫助,因?yàn)楸疚淖畛跏刮易呱狭苏_的軌道,我認(rèn)為我最好發(fā)布更正。



查看完整回答
反對(duì) 回復(fù) 2019-12-07
?
慕田峪4524236

TA貢獻(xiàn)1875條經(jīng)驗(yàn) 獲得超5個(gè)贊

我為jquery ui確認(rèn)對(duì)話(huà)框創(chuàng)建了自己的函數(shù)。這是代碼


function myConfirm(dialogText, okFunc, cancelFunc, dialogTitle) {

  $('<div style="padding: 10px; max-width: 500px; word-wrap: break-word;">' + dialogText + '</div>').dialog({

    draggable: false,

    modal: true,

    resizable: false,

    width: 'auto',

    title: dialogTitle || 'Confirm',

    minHeight: 75,

    buttons: {

      OK: function () {

        if (typeof (okFunc) == 'function') {

          setTimeout(okFunc, 50);

        }

        $(this).dialog('destroy');

      },

      Cancel: function () {

        if (typeof (cancelFunc) == 'function') {

          setTimeout(cancelFunc, 50);

        }

        $(this).dialog('destroy');

      }

    }

  });

}

現(xiàn)在在您的代碼中使用它,只需編寫(xiě)以下內(nèi)容


myConfirm('Do you want to delete this record ?', function () {

    alert('You clicked OK');

  }, function () {

    alert('You clicked Cancel');

  },

  'Confirm Delete'

);

繼續(xù)。



查看完整回答
反對(duì) 回復(fù) 2019-12-07
  • 3 回答
  • 0 關(guān)注
  • 510 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)