Well, I have several projects with title and description in a html code. Every title has a class "nameProject" and I use the following code to get all of them:
var projects = document.querySelectorAll(".nameProject");
And the problem begins here... I'd want that when a user click on one of those titles I can get the value of that specific title. And I'm using this code:
for (var i=0; i<projects.length; i++){
projects[i].addEventListener('click', function(){
alert("Your title is: " + projects[i].value);
});
}
But when I use this code in Javascript, it doesn´t work!! I don't understand what I'm doing wrong :( could you please give me a hand? BTW: Sorry for my english, I'm not native