closest returns undefined
- <input type="text" name="statuteCode" value="" id="txt_search_statuteCode" maxlength="40" size="14" />
<input type='button' id='btnSearchCode' value='' class='button-search' />
var ele = $(this).closest("input[type='text']").prop('id'); // returns undefined, I would expect it to return txt_search_statuteCode while inside the event handler for btnSearchCode
Does anyone know what the problem is here? It does find an object, but I don't know what object
I fixed it like this:
$(this).siblings('input:first').prop('id'); // this works!
The problem seems to be it doesn't like: [type='text']