Every line of 'javascript add id' 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.
89 function getID(id) { 90 return getPrefix()+id; 91 }
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 }
43 function setId(element, idPrefix, idSuffix) { 44 if (!element.is('[id]')) { 45 element.attr('id', idPrefix + idSuffix); 46 } 47 return element.attr('id'); 48 }
22 function generateNewId() { 23 var objectId = new ObjectId(); 24 document.getElementById("timeStamp").value = objectId.getDate(); 25 document.getElementById("machine").value = objectId.machine; 26 document.getElementById("pid").value = objectId.pid; 27 document.getElementById("increment").value = objectId.increment; 28 if (typeof (JSON) == 'object' && typeof (JSON.stringify) == 'function') { 29 var txtNode = document.createTextNode('Raw: '); 30 var element = document.createElement('pre').appendChild(document.createTextNode(JSON.stringify(objectId))); 31 var rawObject = document.getElementById("rawObject"); 32 while (rawObject.childNodes.length > 0) { 33 rawObject.removeChild(rawObject.childNodes[0]); 34 } 35 rawObject.appendChild(txtNode); 36 rawObject.appendChild(element); 37 } 38 }
12 function getId(){ 13 return 'module' + (guid++); 14 }
30 function setId(id) { 31 window.history.pushState("", "", window.location.pathname + "?id=" + id); 32 }
65 function idFunction(value) { 66 return value; 67 }
216 return function getUniqueElementId () { 217 return uniqueElementId += 1; 218 };
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 }
99 function makeId(str) { 100 return 'style-' + str.replace(/[\W-]+/g, '-') + '-style'; 101 }