Why can't I capture the <option> tag with the view selector?
According to the DOC ,
Elements are considered visible if they consume space in the document. Visible items have a width or height that is greater than zero.
I checked the option tag, it seems that there is no css property with it to ignore its space from the DOM. Although, while I select the option
tag using the :visible
selector, it does not select anything. It seems mysterious to me.
HTML:
<select> <option selected=true>test</option> <option>test1</option> <option>test2</option> <option>test3</option> <option>test4</option> </select>
JS:
console.log($('select option:visible').length); // Length always returns 0
Demo
Can someone explain reliably what is happening behind this?
+4
Rajaprabhu aravindasamy
source shareNo one has answered this question yet.
See similar questions:
4
or similar:
1270
1184
540
140
6
1
0
0
0
0