jQuery(function ($) {
$('#button').on('click', function() {
$('.popup').text($(this).attr('title'));
});
});
document.getElementById('button').onclick = function() {
var elements = document.getElementsByClassName('popup');
for(var index in elements) {
elements[index].innerText = this.title;
}
}