Please help on the code in this fiddle. What I'm trying t achieve is to get the input value from a field nearest to the delete button. :
http://jsfiddle.net/w9g3e8mb/11/
function deleteTheCtrl() {
var ctrl_name = $(this).parent().find("div").first().find("input").first().val();
alert("Control Name :: " + ctrl_name);
}
the HTML is as below:
<ul>
<li style="height: 200px; width:300px !important;margin-left: 30px;overflow: visible;">
<label for="control_name">Control Name:</label>
<div class="ui-input-text ui-body-inherit ui-corner-all ui-shadow-inset">
<input name="control_name" id="control_name" value="Fan" type="text"/>
</div>
<button type="button" onclick="deleteTheCtrl()" data-ajax="false" class="ui-btn ui-shadow ui-corner-all ui-icon-delete ui-btn-icon-notext deleteCtrlLink" title="Delete Control" value="Delete Control" height="30px">Get Name</button>
</li>
</ul>