-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,295
  • 6
  • 44
  • 75

1 Answers1

0

try $(this)

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

hope that helps.

geevee
  • 5,281
  • 5
  • 29
  • 48