Why jquery parent child selector is not working here.
Here article element has it's children element section, and section contains html select tag.
So, with parent child logic, it has to work, isn't it ? It is returning undefined.
$(document).on('change', 'select[name="slct_sec"]', function(){
//This one is working
var cls=$('section > select[name="slct_cls"]').val();
//Not working
var cls_1=$(this).parent('section').siblings('section > select[name="slct_cls"]').val();
//Not working
var cls_2=$(this).parent('article').children('section > select[name="slct_cls"]').val();
alert(cls_1);
alert(cls_2);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<head>
</head>
<body>
<article>
<section>
<select name='slct_cls'>
<option value='1'>One</option>
<option value='2'>Two</option>
</select>
</section>
<br/>
<section>
<select name='slct_sec'>
<option value='1'>A</option>
<option value='2'>B</option>
</select>
</section>
</article>
</body>
</html>