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 ( , ) in mytext. can escape or use filter:

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

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -