I have fetched drupal value in js file.I want to pass the variable in html template.I want to include 'anniversaryCount' to html template.Now I caught
Uncaught SyntaxError: Invalid regular expression: /(^|.)cbox(.|$)/: Stack overflow at RegExp.test ()
(function ($) {
Drupal.behaviors.one_time_popup = {
attach: function (context, settings) {
var anniversaryCount = Drupal.settings.one_time_popup.aniv;
console.log(anniversaryCount); //prints correct value
cardTemplate = "<div class='cardTemplate'><span class='birthdayImage'></span><p class='wishes'>Happy Work Anniversary <span id='spl_name'></span> !</p><img src='" + Drupal.settings.publicpath + "/Anniversary_Images/" + anniversaryCount + "Anniversary.jpg'></div>";
}
};
}(jQuery));
with jquery put your html in to the page
$("#your_elemen_id_where_to_put_html").html(cardTemplate);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.