最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Make inline edit in wp_list_table

programmeradmin2浏览0评论

I'm very new to JavaScript and jQuery. However, I've jumped into trying to make inline edit for my wp_list_table but find it difficult to catch the class for some reason.

The classes for the column I'm trying to catch is named

<td class="director column-director">

I've tried the 2 following statements below to check that I actually catch the class correctly:

$( ".director").click(function() {
  alert( "Handler for .click() called." );
});


$( ".director", '.column-director' ).click(function() {
  alert( "Handler for .click() called." );
});

The console shows no errors and nothing is happening when I click the <td>. Is there anyone that can tell me what I'm doing wrong?

I'm very new to JavaScript and jQuery. However, I've jumped into trying to make inline edit for my wp_list_table but find it difficult to catch the class for some reason.

The classes for the column I'm trying to catch is named

<td class="director column-director">

I've tried the 2 following statements below to check that I actually catch the class correctly:

$( ".director").click(function() {
  alert( "Handler for .click() called." );
});


$( ".director", '.column-director' ).click(function() {
  alert( "Handler for .click() called." );
});

The console shows no errors and nothing is happening when I click the <td>. Is there anyone that can tell me what I'm doing wrong?

Share Improve this question edited Nov 22, 2019 at 15:23 butlerblog 5,1213 gold badges28 silver badges44 bronze badges asked Jun 29, 2015 at 9:29 AlexanderAlexander 571 silver badge11 bronze badges 3
  • replace $( ".director", '.column-director' ) by $( ".director, .column-director") – Karun Commented Jun 29, 2015 at 9:35
  • Ty for the answer Karun now i know how to mark serval classes at once :) but it did'nt work, konsol shows no errors and nothing happens when i press the td. – Alexander Commented Jun 29, 2015 at 9:39
  • Is your table an Ajax return? I tested the jQuery code. It was ok. Anyways try replacing $ by jQuery – Karun Commented Jun 29, 2015 at 9:40
Add a comment  | 

1 Answer 1

Reset to default 1

Replace $( ".director", '.column-director' ) by $( ".director, .column-director") and also replace $ by jQuery

发布评论

评论列表(0)

  1. 暂无评论