Loading…

How to set attributes of an element using jQuery?

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

Example

                                        

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

 

Suggest An Answer

No suggestions avaliable!

Latest post from JQuery interview questions

Ask Question