For
<span id="" ...>
<input id="" ...>
Is there any way to retrieve span id? input element is embedded within span?
For
<span id="" ...>
<input id="" ...>
Is there any way to retrieve span id? input element is embedded within span?
If you're using jQuery:
$('#input-id').parent().attr('id');
If not:
document.getElementById('input-id').parentNode.getAttribute('id');
EDIT: Ooops - removed extra parentheses after parentNode!
var parentControl = document.getElementByID("id goes here").parentNode;