Answers for "create a jquery function which changes only a single paragraph’s styling"

1

create a jquery function which changes only a single paragraph’s styling

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
$('p button').click(function(){
  $(this).parent('p').css('backgroundcolor', 'red');
})
<p>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  <button>Click here</button>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</p>

<p>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  <button>Click here</button>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</p>

<p>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  <button>Click here</button>
  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</p>
Posted by: Guest on October-14-2021

Code answers related to "create a jquery function which changes only a single paragraph’s styling"

Code answers related to "Javascript"

Browse Popular Code Answers by Language