Tell me how do you find all the selected options of HTML select tag?
Submitted by: MuhammadThis is one of the tricky jQuery question on Interviews. This is a basic question, but don’t expect every jQuery beginner to know about this. You can use the following jQuery selector to retrieve all the selected options of <select> tag with multiple=true :
$('[name=NameOfSelectedTag] :selected')
This code uses the attribute selector in combination of :selected selector, which returns only selected options. You can tweak this and instead of name, you can even use id attribute to retrieve
<select> tag.
Submitted by: Muhammad
$('[name=NameOfSelectedTag] :selected')
This code uses the attribute selector in combination of :selected selector, which returns only selected options. You can tweak this and instead of name, you can even use id attribute to retrieve
<select> tag.
Submitted by: Muhammad
Read Online Web Development Ninjas Job Interview Questions And Answers
Top Web Development Ninjas Questions
☺ | Tell me how do you hide an image on a button click using jQuery? |
☺ | Do you know what elements have disappeared? |
☺ | Tell me how do you add and remove CSS classes to an element using jQuery? |
☺ | Suppose our hyperlink or image is not displaying correctly, what is wrong with it? |
☺ | Tell us how do you optimize a website’s assets? |
Top Web Developer Categories
☺ | Bootstrap Interview Questions. |
☺ | Front End Web Developer Interview Questions. |
☺ | Typography Interview Questions. |
☺ | Laravel PHP Developer Interview Questions. |
☺ | Junior Developer PHP Interview Questions. |