We often need access of parent elements in the DOM while using jQuery functions.This can be achieved by using element.parent(). Let us take some example: HTML Code: <div id= "div1" > <span> This is span </span> </div> jQuery Code: < script > $($document).ready( function (){ var par_id = ( "span" ).parent().attr( 'id' ); alert(par_id); }); < /script>
This blog is about solutions for PHP,Python,JavaScript,j query,HTML,CSS and Ubuntu.