Skip to main content

Bug Tracker

Side navigation

#9396 closed feature (wontfix)

Opened May 22, 2011 07:18PM UTC

Closed June 07, 2011 06:53PM UTC

Last modified October 15, 2012 03:53PM UTC

.hasAttr([ element ])

Reported by: waynepurtonsmith@hotmail.co.uk Owned by:
Priority: low Milestone: 1.7
Component: attributes Version: 1.6.1
Keywords: 1.7-discuss Cc:
Blocked by: Blocking:
Description

.hasAttr([ element ])

Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.

$('#element').hasAttr('someattribute'); // return either true or false

Attachments (0)
Change History (17)

Changed May 22, 2011 07:27PM UTC by john comment:1

keywords: → 1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 08:10PM UTC by rwaldron comment:2

-1, Can be achieved with existing API

Changed May 22, 2011 09:29PM UTC by anonymous comment:3

Replying to [comment:2 rwaldron]:

-1, Can be achieved with existing API

But it should be easy but implementing it - what happened to the easy writing? ;)

Changed May 23, 2011 01:07AM UTC by jaubourg comment:4

description: .hasAttr([ element ]) \ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g. \ \ $('#element').hasAttr('someattribute'); // return either true or false.hasAttr([ element ])\ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.\ \ $('#element').hasAttr('someattribute'); // return either true or false

+0,

Changed May 23, 2011 05:09AM UTC by timmywil comment:5

-1, .attr('someattribute') !== undefined works fine.

Changed May 24, 2011 12:40AM UTC by timmywil comment:6

component: unfiledattributes
description: .hasAttr([ element ])\ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.\ \ $('#element').hasAttr('someattribute'); // return either true or false.hasAttr([ element ]) \ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g. \ \ $('#element').hasAttr('someattribute'); // return either true or false
priority: undecidedlow
status: newopen

Changed May 24, 2011 10:27PM UTC by dmethvin comment:7

-1, Bytes do not grow on trees you know.

Changed May 30, 2011 08:34PM UTC by anonymous comment:8

Replying to [comment:7 dmethvin]:

-1, Bytes do not grow on trees you know.

It wouldn't be that much... god...

Changed May 31, 2011 03:15PM UTC by rwaldron comment:9

Replying to [comment:8 anonymous]:

Replying to [comment:7 dmethvin]: > -1, Bytes do not grow on trees you know. It wouldn't be that much... god...

Feature request fulfilled: https://gist.github.com/1000671

Changed May 31, 2011 03:42PM UTC by anonymous comment:10

Replying to [comment:9 rwaldron]:

Replying to [comment:8 anonymous]: > Replying to [comment:7 dmethvin]: > > -1, Bytes do not grow on trees you know. > > It wouldn't be that much... god... Feature request fulfilled: https://gist.github.com/1000671

That's pretty good. Would be excellent if it was implemented in the jQuery Core. :-)

Changed June 03, 2011 02:11PM UTC by john comment:11

description: .hasAttr([ element ]) \ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g. \ \ $('#element').hasAttr('someattribute'); // return either true or false.hasAttr([ element ])\ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.\ \ $('#element').hasAttr('someattribute'); // return either true or false

-1, Not really needed now that .attr("name") returns undefined if it isn't defined.

Changed June 04, 2011 10:15PM UTC by addyosmani comment:12

-1

Changed June 05, 2011 10:36PM UTC by ajpiano comment:13

description: .hasAttr([ element ])\ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.\ \ $('#element').hasAttr('someattribute'); // return either true or false.hasAttr([ element ]) \ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g. \ \ $('#element').hasAttr('someattribute'); // return either true or false

-1, Not necessary

Changed June 06, 2011 02:55PM UTC by danheberden comment:14

description: .hasAttr([ element ]) \ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g. \ \ $('#element').hasAttr('someattribute'); // return either true or false.hasAttr([ element ])\ \ Similar to .hasClass() but with the use of attributes, for example we can check whether an element has an attribute, e.g.\ \ $('#element').hasAttr('someattribute'); // return either true or false

-1

Changed June 06, 2011 03:41PM UTC by scottgonzalez comment:15

+1, can already do .is( "[someattribte]" ) but this provides good parity with .hasClass()

Changed June 07, 2011 06:53PM UTC by rwaldron comment:16

milestone: 1.next1.7
resolution: → wontfix
status: openclosed

Closing per 1.7 roadmap meeting resolution

Changed October 15, 2012 03:53PM UTC by rwaldron comment:17

#12732 is a duplicate of this ticket.