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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

使用jQuery向按鈕添加操作

使用jQuery向按鈕添加操作

慕桂英546537 2019-04-18 14:15:49
我有一個表格,它顯示不同級別的數(shù)據(jù)(父,子,孫子),當(dāng)我點(diǎn)擊它顯示與子級別相關(guān)的新行的父級時,如果我點(diǎn)擊子級,它會顯示第三級別作為具有更多行的孫子。我想要做的是在每個記錄上添加一個帶有“+”符號的按鈕,所以當(dāng)我點(diǎn)擊它時,我會看到第二個級別,并用“ - ”符號將該按鈕從父級切換到另一個,以模擬擴(kuò)展和折疊功能,我想為子級別也這樣做。現(xiàn)在,如果我點(diǎn)擊一行,列會展開或折疊,但如果我點(diǎn)擊要添加的按鈕,我想要這樣做。這是我的代碼:    $('.drillDown tr td:last-child, .drillDown tr th:last-child').hide();$('.drillDown tr td:first-child, .drillDown tr th:first-child')     .dblclick(function(){     $('.drillDown tr td:last-child, .drillDown tr th:last-child').show();})     $('table.drillDown').each(function() {         var $table = $(this);         $table.find('.parent').dblclick(function() {             console.log( "*****Click on Parent" );             $(this).nextUntil('.parent', ".child").toggle("fast");              $(this).nextUntil('.parent', ".grandson").hide("fast");         });         $table.find('.child').dblclick(function() {             console.log( "*****Click on child" );             $(this).nextUntil('.child', ".grandson").toggle("fast");          });         var $childRows = $table.find('tbody tr').not('.parent').hide();         $table.find('button.hide').dblclick(function() {             $childRows.hide();         });         $table.find('button.show').dblclick(function() {             console.log("*****Click on Child");             $childRows.filter('.child').show();         });         $table.find('tr.child').dblclick(function(){             $(this).nextUntil('.child').show()         });     });而且我也完整的例子https://jsfiddle.net/ny6qcxtd/2/謝謝!
查看完整描述

6 回答

?
HUX布斯

TA貢獻(xiàn)1876條經(jīng)驗 獲得超6個贊

changed with following fiddle

小提琴


查看完整回答
反對 回復(fù) 2019-05-07
?
素胚勾勒不出你

TA貢獻(xiàn)1827條經(jīng)驗 獲得超9個贊

也許你可以使用這樣的東西:

$(".classOfButton").click(function() {
                $(".classOfWhatYouWantToExpand").fadeToggle("slow", "linear")
            });

因此,在單擊按鈕時使用jQuery .fadeToggle()函數(shù)。只需注意你的目標(biāo)是什么,并適當(dāng)?shù)厥褂妙惢騣d。

fadeToggle() jQuery .click 
()


查看完整回答
反對 回復(fù) 2019-05-07
?
不負(fù)相思意

TA貢獻(xiàn)1777條經(jīng)驗 獲得超10個贊

$("#target").click(function() { 
   alert("click event"); });$("#target").submit(function() { 
   alert("submit event"); });


查看完整回答
反對 回復(fù) 2019-05-07
?
蕭十郎

TA貢獻(xiàn)1815條經(jīng)驗 獲得超13個贊

只需綁定按鈕單擊功能,請參閱下面的代碼。

為了exa。

$( "#dataTable tbody tr" ).on( "click", function() {
  console.log( $( this ).text() );});

為你的代碼看起來像,

$( "#target" ).on( "click", function() {
 console.log( $( this ).text() );});


查看完整回答
反對 回復(fù) 2019-05-07
  • 6 回答
  • 0 關(guān)注
  • 936 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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