首页 \ 问答 \ 如何获取使用Jquery动态添加的HTML表行记录?(How to get the HTML Table row records which is added dynamically using Jquery?)

如何获取使用Jquery动态添加的HTML表行记录?(How to get the HTML Table row records which is added dynamically using Jquery?)

我想得到行记录,这是动态添加的。 如果我使用html添加行,我将获得输出。

一开始,表格中没有记录。 这是我的代码。

HTML代码

<table class="table table-hover " id="queryTable">
    <thead>
        <tr>
           <th>Field Name</th>
           <th>Values</th>
        </tr>
    </thead>
    <tbody>

    </tbody>
</table>

表与空行开始 当用户单击ADD按钮时 ,将成功使用jquery添加行

用户单击ADD按钮添加行后 JQUERY代码

$('#queryTable > tbody:last-child').append('<tr><td class="FieldNameID">' + selectedField + '</td><td class="OperatorID"> IN(' + $("#txtFilterValue").val() + ')</td></tr>');

到目前为止它工作正常。 现在,当用户点击任何一行时,我想选择行并在警告框中显示它,这是动态添加的。


I want to get the row records, which is added dynamically. I am getting an output if I add the row using html.

At beginning there will be no records in table. this is my code.

HTML Code

<table class="table table-hover " id="queryTable">
    <thead>
        <tr>
           <th>Field Name</th>
           <th>Values</th>
        </tr>
    </thead>
    <tbody>

    </tbody>
</table>

Table with empty row At beginning When user click ADD ButtonIt will be added rows using jquery successfully

After Added rows by user clicking the ADD Button JQUERY Code

$('#queryTable > tbody:last-child').append('<tr><td class="FieldNameID">' + selectedField + '</td><td class="OperatorID"> IN(' + $("#txtFilterValue").val() + ')</td></tr>');

Upto this it's working fine. Now, When user clicks on any row, I want to select the row and show it in alert box, which is added dynamcally.


原文:https://stackoverflow.com/questions/41996691
更新时间:2023-11-22 06:11

最满意答案

您需要使用sigsetjmpsiglongjmp而不是常规版本,因为常规版本无法正确恢复信号掩码。 这是您的代码的工作版本:

#include <stdio.h>
#include <signal.h>
#include <setjmp.h>

jmp_buf env;

void handler(int sig) {
    printf("Invalid input , try again\n");
    siglongjmp(env , 1);
}

int main() {
    int x , y;

    signal(SIGFPE , handler);
    sigsetjmp(env, 1);
    scanf("%d%d" , &x , &y);
    printf("%d %d\n" , x, y);
    printf("%d\n" , x / y);
}

顺便说一句,我尝试使用Joachim Pileborg在评论中建议的sigaction ,但它对我没有帮助。 我认为这里的关键是如果你只是简单的longjmp退出信号处理程序,信号上下文不会被恢复(意味着SIGFPE可能会处于禁用状态)。


You need to use sigsetjmp and siglongjmp instead of the regular versions, because the regular versions do not properly restore your signal masks. Here is a working version of your code:

#include <stdio.h>
#include <signal.h>
#include <setjmp.h>

jmp_buf env;

void handler(int sig) {
    printf("Invalid input , try again\n");
    siglongjmp(env , 1);
}

int main() {
    int x , y;

    signal(SIGFPE , handler);
    sigsetjmp(env, 1);
    scanf("%d%d" , &x , &y);
    printf("%d %d\n" , x, y);
    printf("%d\n" , x / y);
}

By the way, I tried using sigaction as suggested by Joachim Pileborg in the comments, but it did not help for me. I think the key here is that if you just plain longjmp to exit a signal handler, the signal context is not restored (meaning SIGFPE might be left in a disabled state).

相关问答

更多
  • 问题是在安装信号处理函数时, signal()函数可能有两种不同的行为形式: 系统V语义,信号处理程序是“一次性的” - 即在调用信号处理函数之后,信号的处置被重置为SIG_DFL - 并且由信号中断的系统调用不会重新启动; 要么 BSD语义,当信号触发时信号处理程序未被重置,信号处理程序正在执行时信号被阻塞,并且大多数中断的系统调用会自动重新启动。 在使用glibc的Linux上,如果定义了_BSD_SOURCE ,则会得到BSD语义;如果_BSD_SOURCE ,则会得到System V语义。 _BSD ...
  • 如果您考虑到Linux黑客往往对线程和进程之间的区别感到困惑,主要是由于尝试假装线程的历史错误可以被实现为共享进程的事实,这两个解释真的不矛盾记忆。 :-) 说到这里,说明#2更加详细,完整和正确。 对于堆栈和寄存器内容,每个线程可以注册自己的备用信号处理堆栈,并且该过程可以在每个信号的基础上选择哪些信号将在交替的信号处理堆栈上传送。 中断的上下文(寄存器,信号掩码等)将被保存在线程的(可能的备用)堆栈上的ucontext_t结构中,以及蹦床返回地址。 与SA_SIGINFO标志一起安装的信号处理程序能够检 ...
  • 有一种通过GLIB使用信号的方法 ! 这些是可用于处理信号的一些功能: guint g_unix_signal_add (gint signum, GSourceFunc handler, gpointer user_d ...
  • 基本上最好删除你在示例中放入的所有伪代码,并留下最小的工作代码,具体到底是什么。 从我到目前为止看到的例子来看, sigaction的错误处理是缺失的。 尝试对代码中的错误执行检查。 I am writing this for those who had faced with this problem. My problem was about synchronization of threads. After i got handle synchronization problem, the progra ...
  • struct sigevent不是指定进程如何处理信号 - struct sigaction和sigaction()是你如何做的。 相反, struct sigevent用于指定如何通知某个异步事件的进程 - 例如完成异步IO或定时器到期。 sigev_notify字段指定如何通知事件: SIGEV_NONE - 根本没有通知。 其余的字段被忽略。 SIGEV_SIGNAL - 一个信号被发送到进程。 sigev_signo字段指定信号, sigev_value字段包含传递给信号处理函数的补充数据,其余字段 ...
  • 在混合信号和跳转时,必须使用sigsetjmp / siglongjmp来确保正确的行为。 如果您更改了代码,它将在Linux下正常工作。 您还使用了不推荐的旧信号API。 我鼓励您使用更可靠的sigaction接口。 第一个好处是你不再需要重置处理程序中的信号捕获... You must use sigsetjmp/siglongjmp to ensure the correct behavior when mixing signals and jumps. If you change your code ...
  • 不便携。 但这适用于x86_64: 结构ucontext_t包含寄存器REG_RIP的值,它应该保存您要查找的值。 这是从sighandler返回后将执行的第一条指令。 其他架构应该有类似的寄存器(x86_32上的EIP等)。 Not portable. But this is for x86_64: The structure ucontext_t contains the value of the register REG_RIP, which should hold the value you loo ...
  • 您需要使用sigsetjmp和siglongjmp而不是常规版本,因为常规版本无法正确恢复信号掩码。 这是您的代码的工作版本: #include #include #include jmp_buf env; void handler(int sig) { printf("Invalid input , try again\n"); siglongjmp(env , 1); } int main() { int x ...
  • 当存在具有相同代码的待处理信号时,某些信号可能会丢失。 从sigaction的规范: 如果生成了后续发生的待处理信号,则在实时信号扩展选项下需要排队的情况以外的情况下,信号是否被多次传送或接受是依赖于实现的。 未指定SIGRTMIN到SIGRTMAX范围之外的多个同时未决信号被传送到过程或由过程接受的顺序。 如果你想捕获所有信号,你有两个解决方案: 使用具有SIGRTMIN到SIGRTMAX值的实时信号,而不是SIGUSR1和SIGUSR2。 如果SIGQUEUE_MAX信号未决或者系统没有足够的资源对信号 ...
  • 信号(SIGQUIT,SIG_IGN); 从您的信号处理程序,您告诉您的程序忽略任何进一步的信号发生情况。 因此,当您再次发送信号时,它会被忽略,就像您告诉它一样。 signal(SIGQUIT,SIG_IGN); From your signal handler, you told your program to ignore any further cases of the signal happening. As a result, as you send the signal again, it i ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)