What is the difference between prop and attr?



What is the difference between prop and attr?..

Answer / Sumit Raj Sharma

In jQuery, `prop()` gets or sets a DOM element's property value directly. On the other hand, `attr()` gets or sets an attribute from the HTML markup of a DOM element.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More jQuery Interview Questions

What is the name of jquery method used for an asynchronous http request?

1 Answers  


What are the two types of CDNs?

1 Answers  


What are different type of selector in jQuery?

1 Answers   Wipro,


How we can select multiple elements in jquery?

1 Answers  


You get "jquery is not defined" or "$ is not defined" error. What could be the reason?

1 Answers  


Tell me do I need to add the jquery file both at the master page and content page as well?

1 Answers  


Define url paremeter of jquery ajax method?

1 Answers  


What is called chaining?

1 Answers  


How to disable jQuery animation?

2 Answers  


Why we use jquery .each() function?

1 Answers  


What is a cdn? : jQuery Mobile

1 Answers  


Can you include multiple version of jQuery? If yes, then how they are executed?

1 Answers  


Categories