Every line of 'javascript check if id exists' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
21 function hasId(id) { 22 //有此id返回true,否则返回false 23 var element = document.getElementById(id); 24 if (element) { 25 return true 26 } else { 27 return false 28 } 29 }
119 function check(idStr){ 120 var that = $("#"+idStr) 121 var parent = that.parent() 122 if(that.val().trim()==""){ 123 var msg; 124 if(idStr=="name"){ 125 msg = "名称不能为空" 126 } 127 that.addClass("is-invalid") 128 if(parent.children("[name='nameError']").length==0){ 129 parent.append('<div>'+msg+'</div>') 130 } 131 return false; 132 }else{ 133 that.removeClass("is-invalid") 134 parent.children("[name='nameError']").remove(); 135 return true 136 } 137 }
15 function _validateId(id) { 16 if (id && typeof id !== 'undefined' && parseInt(id) > 0) { 17 return true; 18 } 19 20 return false; 21 }
55 function setIdHasCheck(id, hasCheck) { 56 if (OS_ANDROID) { 57 $[id + 'Check'].visible = hasCheck; 58 } else { 59 $[id].hasCheck = hasCheck; 60 } 61 }
205 checkId (id) { 206 if (id in this.players) { return true; } 207 else { return false; } 208 }
17 function CheckExists(id) { 18 var idName = "assets/" + id.toLowerCase(); 19 var idNoExt = idName.substring(0, idName.lastIndexOf(".")); 20 return allFiles.hasOwnProperty(idName) || allAssets.hasOwnProperty(idNoExt); 21 }
135 isValidId(id) { 136 return id !== undefined && id !== 0 && id !== '' 137 }
1 function jsCheck(id) 2 { 3 el=document.getElementById(id); 4 el.checked='checked'; 5 }
13 function isValid(id) { 14 if (!id || !(typeof id === 'number' || id instanceof Number) && id.length !== 12 && id.length !== 24) { 15 return false; 16 } 17 18 if ((typeof id === 'string' || id instanceof String) && id.length === 24) { 19 return /^[0-9a-fA-F]{24}$/i.test(id); 20 } 21 22 return true; 23 }
15 function getId(id, callback) { 16 17 var filename = getFilename(id); 18 19 s3.getObject({ 20 Bucket: settings.bucket, 21 Key: filename 22 }, function(error, data) { 23 if(error) { 24 if(error.code == 'NoSuchKey') { 25 callback({code:404,msgs:["Not Found"]}); 26 } else { 27 callback({code:500,msgs:["S3 Retrieval Error"]}); 28 } 29 } else { 30 callback(null,JSON.parse(data.Body)); 31 } 32 }); 33 34 }