Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to disable & enable all contents of a Div
    primarykey
    data
    text
    <p>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 <a href="https://stackoverflow.com/a/6961709/1624583">this</a>, but it is not working. Here is the code I have tried(But it works for input only):</p> <pre><code> $('#EditorRows *').attr('disabled', true); </code></pre> <p>I know disable for input types but I want to achieve that type of mechanism for links.</p> <blockquote> <p><strong>1st PartialView Code:</strong></p> </blockquote> <pre><code>&lt;div id="Part2"&gt; &lt;div id="EditorRows"&gt; &lt;%= Html.ActionLink("Add another...", "Add", null, new { id = "addItem" }) %&gt; &lt;%Html.RenderPartial("_InsertServices", Model);%&gt; &lt;/div&gt; &lt;div id="DontAppend"&gt; &lt;input type="button" id="btnEdit" value="Edit" hidden="hidden"/&gt; &lt;input type="button" id="btnDone" value="Done" /&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <blockquote> <p><strong>2nd PartialView</strong></p> </blockquote> <pre><code>&lt;div class="EditorRow"&gt; &lt;% using (Html.BeginCollectionItem("services")) { %&gt; &lt;table id="table1"&gt; &lt;tr&gt;&lt;td&gt; NOS:&lt;/td&gt;&lt;td&gt; &lt;%:Html.DropDownListFor(model=&gt;model.Id,(SelectList)ViewData["crmServiceType"] as SelectList,"---")%&gt; &lt;/td&gt; &lt;td&gt; Comment:&lt;/td&gt;&lt;td&gt; &lt;%=Html.TextBoxFor(model =&gt; model.Comment, new { size = "20" })%&gt;&lt;/td&gt; &lt;td&gt; &lt;a href="#" class="deleteRow"&gt;delete&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;% } %&gt; &lt;/div&gt; </code></pre> <blockquote> <p><strong>script:</strong></p> </blockquote> <pre><code> $("#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); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload