I am trying to disable all elements of Div tag. I get success on input types. But not able to disable links. I have also tried this, but it is not working. Here is the code I have tried(But it works for input only):
$('#EditorRows *').attr('disabled', true);
I know disable for input types but I want to achieve that type of mechanism for links.
1st PartialView Code:
<div id="Part2">
<div id="EditorRows">
<%= Html.ActionLink("Add another...", "Add", null, new { id = "addItem" }) %>
<%Html.RenderPartial("_InsertServices", Model);%>
</div>
<div id="DontAppend">
<input type="button" id="btnEdit" value="Edit" hidden="hidden"/>
<input type="button" id="btnDone" value="Done" />
</div>
</div>
2nd PartialView
<div class="EditorRow">
<% using (Html.BeginCollectionItem("services"))
{ %>
<table id="table1">
<tr><td>
NOS:</td><td>
<%:Html.DropDownListFor(model=>model.Id,(SelectList)ViewData["crmServiceType"] as SelectList,"---")%>
</td>
<td>
Comment:</td><td>
<%=Html.TextBoxFor(model => model.Comment, new { size = "20" })%></td>
<td>
<a href="#" class="deleteRow">delete</a>
</td>
</tr>
</table>
<% } %>
</div>
script:
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) { $("#EditorRows").append(html); }
});
return false;
});
$("a.deleteRow").live("click", function () {
$(this).parents("div.EditorRow:first").remove();
return false;
});
$('#btnDone').click(function () {
$('#EditorRows *').attr('disabled', true);
}
$('#btnEdit').click(function () {
$('#EditorRows *').attr('disabled', false);
}