开发者

Replacing Class with variable

开发者 https://www.devze.com 2022-12-08 00:42 出处:网络
Just a simple question, Im trying to replace class with var, but obviously still something wrong in the string.

Just a simple question,

Im trying to replace class with var, but obviously still something wrong in the string.

I'm doing this:

var C = $('.form')         

    $(" ' " + C + "' tr").remove();

and trying to achieve this:

$(".form tr").remove();

I know that might be simple question, but pleas开发者_JAVA百科e forgive me, Im still learning basics

Thanks


It is as easy as:

var C = $('.form') 
c.find('tr').remove(); 

but you might do this too (maybe slower in some cases)

var c = ".form";
$(c + ' tr').remove();


try

var C = ".form";
$(C + " tr").remove();
0

精彩评论

暂无评论...
验证码 换一张
取 消