mercredi 27 janvier 2016

Improve performance while selecting element from DOM

I have more than 20,000 records(rows) in my DOM. Each row has one checkbox and and textbox. When I check any checkbox its corresponding textbox should get disabled that's how logic works.

If Checkbox has id '1' then its corresponding textbox's id is 'text_1',the logic is textbox's id ="text_"+checkbox_id

Scenario : If I have list 10000 id's in random order (of checkboxes), I have to disable their corresponding textbox. My logic below

idList.each(function(id){
        $('#text'+id).attr("disabled",true).val("");
      }
    });

This logic takes around 10-12 sec to disabled all the textboxes.

Is there any way to improve performance.




Aucun commentaire:

Enregistrer un commentaire