I am trying to get a link from an appended element.
The link is appended like so:
var imdbPointer = "https://www.imdb.com/title/" + data.imdb_id
imdbLink.empty()
imdbLink.append("<a href='" + imdbPointer + "'>" + "IMDB - " + data.original_title + "</a>")
This essentially generates an imdb link for me. I was previously using
var storeIMDBLink = $( "a" ).attr( "href") This code successfuly got me the link when it was the only href one the page, however it grabs the first href it finds.
How can I grab a specific href link from this appended element?
Managed to get there with some hackiness.
var storeIMDBLink = $(this).parent().siblings('#imdb-link').children().attr( "href")
Both the imdb link and button that stored it were appended to the same UL