如何获取使用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>
$('#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>
When user click ADD ButtonIt will be added rows using jquery successfully
$('#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
最满意答案
您需要使用
sigsetjmp
和siglongjmp
而不是常规版本,因为常规版本无法正确恢复信号掩码。 这是您的代码的工作版本:#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
andsiglongjmp
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 plainlongjmp
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字段包含传递给信号处理函数的补充数据,其余字段 ...
-
为什么我会遇到Linux信号处理的意外行为?(Why am I experiencing unexpected behavior with Linux signal handling?)[2022-07-26]
在混合信号和跳转时,必须使用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 ... -
Linux信号处理。(Linux signal handling. How to get address of interrupted instruction? [duplicate])[2023-07-25]
不便携。 但这适用于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 ... -
linux中的信号处理(Signal handling in linux)[2022-01-30]
您需要使用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 ...