jQuery删除具有非标准id字符的表行 [英] jQuery remove table row with non-standard id characters

查看:95
本文介绍了jQuery删除具有非标准id字符的表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jQuery删除表格行

I am trying to remove a table row using jQuery like this

function removeTableRow(trId){
    $('#' + trId).remove();
}

但是如果id包含像%这样的字符,这不起作用,^,&,,等....

However this doesn't work if the id contains a character like "%", "^", "&", ",", etc....

你知道是否有任何解决方法吗?

Do you know if there is any work around for this?

推荐答案

我相信原因可以在这里找到: HTML中id属性的有效值是什么?

I believe the reason why can be found here: What are valid values for the id attribute in HTML?

但是除了显而易见的(改变你的ID)

However I'm not so sure about a workaround other than the obvious (change your ids)

这篇关于jQuery删除具有非标准id字符的表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆