-2
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});

In the code above I want to call the "button" object and get some attribute values from it inside the function called by clicking the button. How can I do that?

EternallyCurious
  • 2,345
  • 7
  • 47
  • 78

1 Answers1

0

try $(this)

$(document).ready(function(){
  $("button").click(function(){
    $(this).val('I WAS CLICKED!');
    $("p").hide();
  });
});

hope that helps.

geevee
  • 5,411
  • 5
  • 30
  • 48