I see the following piece of code
input[type='button']text:visible:enabled:first
What does this code do. Which feature of jquery is this? Is this selector example? Any links to read more on it?
I see the following piece of code
input[type='button']text:visible:enabled:first
What does this code do. Which feature of jquery is this? Is this selector example? Any links to read more on it?
That exact piece of code is not a valid selector, but if you split them up they are filters and they are used to make a selector.
$('input[type="button"]') // references <input type=button>
The others are just filters denoted by the colon.
:text //matches all input type=text
:visible //*tries* to return what elements are visible
:enabled //matches elements that are enabled
:first //grabs the first in the selector set.
Usage: $('el:visible')
Reference: http://docs.jquery.com/Selectors
That's probably intended to be a selector, yes. I don't think the input[type='button']text portion is going to work though.
The jQuery documentation has a good rundown of all the various selectors: http://docs.jquery.com/Selectors
Also check out SelectorGadget. It's an interactive selector building GUI that loads right into your browser.
This is indeed a selector, assuming that it is in something like this $() or this $j(). If I am reading it right it is looking for:
input any input
[type='button']
with the type button
that is
:visible
:enabled
:first and the first such element.
(Unfortunately, as it stands it is also broken.)
input[type='button']
Is a selector, though in jQurey it needs to be wrapped in $(" ") to do something.
This kind of selector is bigger than a jQuery feature, it's XPath http://www.w3schools.com/XPath/default.asp , which is a system of selecting pieces ("nodes") of XML. The HTML we use in web pages is a sort of XML and XPath is a type of statement you can apply to HTML if you want to find ('select') certain pieces of it.
So jQuery allows you to use XPath query statements as selectors. XPath queries are just one type of selector that jQuery provides access to, there are also CSS selectors http://www.w3schools.com/Css/css%5Fsyntax.asp, which is a different system. As other's have mentioned, read up on the jQuery selector documentation http://docs.jquery.com/Selectors, which should help explain a lot.