jquery get id of input field
javascript, jquery, sharepoint
Solution
You might want this :
var id = $('#idEstablishmentRow td.ms-formbody span input').attr('id');
But as your HTML doesn't have any element whose id is `idEstablishmentRow`, it's hard to be sure of what you exactly want.
Demonstration
Problem
i need to get the id of a input that's inside a span of a sharepoint list. it looks like the code below. ``` <tr id="idEstablishmentRow"> <td class="ms-formbody" vAlign="top"> <span dir="none"> <span style="vertical-align: middle;"> <input type='text' id='hello' /> </span> </span> </td> </tr> ``` now i want to get the id of the input. i have tried: ``` var _test = $('#idEstablishmentRow').find('td.ms-formbody'); var _test1 = _test.find('span.style'); var _test2 = _test1.find('input'); var _test3 = _test2.attr('id'); alert(_test3); alert(_test2); ``` but it didn't work. could anyone help me ?