Get the Node using JavaScript, then modify it to fit your needs:
var container = document.querySelector(".g-popupgrid-item .g-zoom")
container.setAttribute("data-size", value)
Keep in mind this will only affect the first element with those classes, if you want affect them all, use the code below:
var containers = document.querySelectorAll(".g-popupgrid-item .g-zoom")
containers.forEach(function(container) {
container.setAttribute("data-size", value)
})
Also keep in mind that containers is not an Array it's a NodeList. Read more here
EDIT: According to @Eoin, the .forEach() method on NodeLists is not supported in Firefox. You can also use a standard for loop in place of it:
var containers = document.querySelectorAll(".g-popupgrid-item .g-zoom")
for (var i = 0; i < containers.length; i++) {
containers[i].setAttribute("data-size", value)
}
.setAttribute()in jquery. it's as simple as$('.g-popupgrid-item .g-zoom').attr('data-size', var_with_value_you_want)