Using the jQuery attr() method attributes, an element can be set and added. This is also dynamically done in HTML elements.

BY Best Interview Question ON 14 Sep 2019

Example

$("#bestinterviewquestion").click(function(){
   $("p").attr("padding","10px");
});

 

Suggest An Answer