Remove an attribute:: >>> d = PyQuery(' ') >>> d.remove_attr('id') [ ] >>> d.removeAttr('id') [ ] ..
(self, name)
| 796 | |
| 797 | @with_camel_case_alias |
| 798 | def remove_attr(self, name): |
| 799 | """Remove an attribute:: |
| 800 | |
| 801 | >>> d = PyQuery('<div id="myid"></div>') |
| 802 | >>> d.remove_attr('id') |
| 803 | [<div>] |
| 804 | >>> d.removeAttr('id') |
| 805 | [<div>] |
| 806 | |
| 807 | .. |
| 808 | """ |
| 809 | for tag in self: |
| 810 | try: |
| 811 | del tag.attrib[name] |
| 812 | except KeyError: |
| 813 | pass |
| 814 | return self |
| 815 | |
| 816 | attr = FlexibleElement(pget=attr, pdel=remove_attr) |
| 817 |