Streaming live at 10am (PST)

Onclick find children inside of div

Hey guys,

So right now using the method below, I have to have the “.link” text nested inside of one of the two buttons in order for it to be attributed to the “#link”.

Is there a way to be able to click either btn1 or btn2 and have the function run (where the #link text takes the attributes of “.link”)?

Can I call an unrelated div that nests the .link class?

    $(".btn1, .btn2").on("click", function() {
   	   var x = $(this).find(".link").text();
       $("#link").attr("href", x);


If anyone needs the solution to the problem see the Stack Overflow thread here:

1 Like