querySelectorAll
returns a NodeList, not a single element (even if the result of the query is only one element). So you are trying to attach an event listener to that NodeList, not to an element.
This does work (note the [0]
):
var topPods = document.querySelectorAll(".top");
topPods[0].addEventListener("dragstart", dragStart);