Some quick tips;
Look at caching
$(this)
Look at caching$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);
Some quick tips;
Look at caching
$(this)
. You're regularly re-creating a jQuery object that doesn't change.Adhere to the common JavaScript coding conventions; normally a variable that starts with a capital letter denotes a constructor (that should be invoked with
new
). Change all yourSaturdayFromHValues
etc variable names tosaturdayFromHValues
As mentioned by @priteaes, you should save the HTML you're constructing to a string and write it to the element once. DOM manipulation is slow, and the browser will be re-paining the window with each
append()
you're using;$(this).append('<div id="label">' + day + ': </div>') .append('<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>') .append('<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>')
Becomes:
var html = '';
html += '<div id="label">' + day + ': </div>';
html += '<select id="' + day + 'FromH" name="' + day + 'FromH" class="hour from"></select>';
html += '<select id="' + day + 'FromM" name="' + day + 'FromM" class="min from"></select>';
$(this).append(html);