I have the following code
function manChecks() {
if ($("#__CS").length > 0) {
var cols = $("#__CS").val();
for (var i = 1; i <= 9; i++) {
colManage(i, cols.indexOf('|' + i) != -1);
}
}
}
So what happens if that code is less than 0 it shouldn’t run – but it seems to be causing an issue.
Have a written this correctly or have I missed something.
What your code currently does:
#__CSdoes not exist in the document, do nothing (this check will not cause an error)#__CSdoes exist, its.val()will be set tocols. This will never cause an error.colManagewill be called, passing a value from 1 to 9, together with an indication of whether or not|1to|9exists in the stringcols. This call will never cause your code to break either, but something incolManagecould very well cause it to break.