JavaScript

Optimizing jQuery Selector

I have five forms that has tons of JavaScript data validations and AJAX calls. Worst, it is looping intensive. As a result, it was too slow. At first I thought it was just because I have so many fields on the form. However, as the need to optimized it, I’ve read some jQuery selector optimization technique.

I have a lot of looping structure which uses this kind of selector in jQuery:

var x =0;
var val = null;

workComCdChange.prev = $(“[id=Work_Com_Cd]”).val();
tariffCdChange.prev = $(“[id=Tariff_Cd]”).val();

for (x=0; x

Leave a reply

Your email address will not be published. Required fields are marked *