{"action":"opened","issue":{"url":"https://api.github.com/repos/yoky/blog/issues/1","repository_url":"https://api.github.com/repos/yoky/blog","labels_url":"https://api.github.com/repos/yoky/blog/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/yoky/blog/issues/1/comments","events_url":"https://api.github.com/repos/yoky/blog/issues/1/events","html_url":"https://github.com/yoky/blog/issues/1","id":299615436,"number":1,"title":"jQuery中，attr（）和prop（）的区别？","user":{"login":"yoky","id":14164389,"avatar_url":"https://avatars2.githubusercontent.com/u/14164389?v=4","gravatar_id":"","url":"https://api.github.com/users/yoky","html_url":"https://github.com/yoky","followers_url":"https://api.github.com/users/yoky/followers","following_url":"https://api.github.com/users/yoky/following{/other_user}","gists_url":"https://api.github.com/users/yoky/gists{/gist_id}","starred_url":"https://api.github.com/users/yoky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yoky/subscriptions","organizations_url":"https://api.github.com/users/yoky/orgs","repos_url":"https://api.github.com/users/yoky/repos","events_url":"https://api.github.com/users/yoky/events{/privacy}","received_events_url":"https://api.github.com/users/yoky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-23T06:49:58Z","updated_at":"2018-02-23T06:49:58Z","closed_at":null,"author_association":"OWNER","body":"学习《DOM探索之基础详解篇》中，我们需要知道dom节点的类型，目的是知道操作dom的属性是用元素的直接属性操作还是使用setAttribute方法操作。\r\n那么：\r\n**Q：什么是元素的直接属性？**  \r\n**A**：元素天生自带的属性，比如id，class等。因此，我们coder自定义的属性就是非直接属性啦。  \r\n\r\n\r\n**Q：如何获取？？**  \r\n**A**：直接属性使用dom对象可直接获取、修改。自定义属性使用setAttribute（）设置、获取。  \r\nPS：setAttribute（）方法也能设置dom的直接属性。同理，getAttribute（）也能获取dom的直接属性。  \r\n\r\n### **引申：**  \r\n**Q：jQuery的attr和prop方法的区别？**  \r\n**A**：attr（）方法可以设置、获取jQuery对象的直接属性及自定义属性。prop（）方法**只能**获取、设置jQuery对象的**直接属性**。 "}}
{"actor":{"display_login":"yoky"}}