How to select Multiple XML Tags as XElement, filtering based on same attribute. I have Below code i want to select tags with are having action=true
<root>
<first action="true">
<path>E:\Myfolder</path>
</first>
<second>
<path>C:\Users\</path>
</second>
<third action="true">
<name>Mytasks</name>
</third>
</root>
and Output shout be like this
<first action="true">
<path>E:\Myfolder</path>
</first>
<third action="true">
<name>Mytasks</name>
</third>
anybody please help me. I used FirstorDefault() But i am getting only one record among all
Try This .
$(path).find('root').find('[action="true"]')