Click here to Skip to main content
15,895,370 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all,

Please help me to how to get value from below code....
XML
<ul>
  <li>
     <div>
     <input type="chechkbox" value="Level1"/>
     </div>
     <ul>
         <li>
           <div>
             <input type="chechkbox" value="Level1"/>
           </div>
         </li>
<li>
           <div>
             <input type="chechkbox" value="Level1"/>
           </div>
         </li>
     </ul>
  </li>
</ul>



How to get parent ul li checkbox value if children li is checked
Posted

Even though you can mark any element with id and that find it by the id value, it could be too much of ad-hoc approach. What you need is the HTML DOM inquiry. One good way to work with DOM directly and also modify HTML via DOM would be using jQuery. Please see:
http://api.jquery.com/parent/[^],
http://api.jquery.com/category/traversing/[^].

See also: http://api.jquery.com/category/manipulation/[^].

If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com[^],
http://learn.jquery.com[^],
http://learn.jquery.com/using-jquery-core[^],
http://learn.jquery.com/about-jquery/how-jquery-works[^] (start from here).

Remember that jQuery is designed with compatibility in mind.

—SA
 
Share this answer
 
Comments
Mayank Engineer 30-Oct-13 0:19am    
i learn many more your suggested site thanks........:)
Sergey Alexandrovich Kryukov 30-Oct-13 1:10am    
You are welcome. Will you accept the answer formally (green "Accept" button)?
—SA
$("input[checked=checked]").parent()
 
Share this answer
 
Comments
Mayank Engineer 30-Oct-13 0:19am    
thanks for your suggestion

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900