var className = "order_enc_YUluWTo6ODA4OTczNjQ3MjAzOTc0OA==";
$('input:checkbox.' className).each(function() {
(this.checked ? arr.push($(this).val()) : "");
});
having encrypted class name but when trying to run loop getting error Uncaught Error: Syntax error, unrecognized expression: input:checkbox.order_enc_YUluWTo6ODA4OTczNjQ3MjAzOTc0OA==
tried single double quots but with no success.
CodePudding user response:
Try this way
<input type="checkbox" class="order_enc_YUluWTo6ODA4OTczNjQ3MjAzOTc0OA==" value="true">
var className = "order_enc_YUluWTo6ODA4OTczNjQ3MjAzOTc0OA==";
$('input:checkbox[hljs-string">'"]').each(function() {
(this.checked ? arr.push($(this).val()) : "");
});
CodePudding user response:
// Connect in HTML file the src for the CryptoJs Lib
/* <script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js">
</script> */
let className = "order_enc_YUluWTo6ODA4OTczNjQ3MjAzOTc0OA==";
let decrypt = CryptoJS.AES.decrypt(className,'Secure className');
let decryptToString = decrypt.toString(CryptoJS.enc.Utf8);
$('input' decryptToString).each(function() {
($(this).checked ? arr.push($(this).val()) : "");
console.log($(this).val())
});