javascript - Jquery find method hangs my whole browser -
jquery find() makes whole browser stops working.
the line on browser stops working one:
item.find('div:contains(\'' + mytext + '\')').remove();
specifically, part before remove(), find() part.
here values of variables:
mytext: "grand sauce ()" item: e.fn.e.init[1] 0: a.ui-corner-all ui-state-hover item[0].innertext: "grand sauce...302774" item[0].innerhtml: "<table style=" width: 100%; font-size:10px;" name="grand sauce ()"><tbody><tr><td id="column1" style="width:170px; padding:2px 2px 2px 8px;position: relative;">grand sauce...302774</td><td style="width:50px; padding:2px;">302774</td><td style="width:70px; padding:2px;">supp</td><td style="width:70px; padding:2px;"></td><td style="width:50px; padding:2px;">2.00</td><td style="width:80px; padding:2px;">93ml</td><td style="width:90px; padding:2px;"> € 1.35</td></tr></tbody></table>"
why browser hangs? innerhtml isn't big @ all.
i think issue can escape or use filter:(
, )
in mytext.
item.find('div').filter(function(){ return $(this).text().indexof(mytext) > -1; }).remove();
try can try way:
$('div:contains("' + mytext + '")').remove();
here's demo: http://jsbin.com/ehuqux/2/edit
errr, actually, way posted works well. there's else code think.
Comments
Post a Comment