JavaScript enable form when another row edit click enable button when form is valid angular,enable button when

I have the form disabled when click edit form is enable

<% while(resultset.next()){ %>
<form method='POST' action='EditCompany?id=<%= resultset.getString(1)%>'>
<tbody>
    <tr align='center'>
        <td><%= no %></td>
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(2)%>' name='company_name'></td>  
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(3)%>' name='city'></td>  
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(4)%>' name='state'></td> 
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(5)%>' name='zipcode'></td>   
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(6)%>' name='branch'></td>    
        <td><input class="form-control aaa" type="text" disabled="disabled" value='<%= resultset.getString(7)%>' name='address'></td>
        <td><a class='abc' id='elementId' onclick="showDiv()"><span class='glyphicon glyphicon-pencil'></span></a> <input type='submit' class="welcomeDiv" style="display:none;"></td>
        <td><a target='_blank' href="#" data-target='_blank' href="DeleteCompany?id=<%= resultset.getString(1)%>" data-toggle="modal" data-target="#confirm-delete"><span class="glyphicon glyphicon-trash"></span></a></td>
    </tr>
    </tbody>
    </form>
    <% no++; } %>

This is the Javascript :

<script type="text/javascript"> 
$('.abc').click(function(){
    $(this).closest('tr').find('.aaa').attr('disabled',false);
});</script>

This is fact

enter image description here

But I want like this. When I want to cancel to edit row 1 and I want to edit row 2, I want the row 1 disabled like this

enter image description here

Answer:1

You can try this:

<script type="text/javascript"> 
$('.abc').click(function(){
    $(this).parents('tr').parent().find('.aaa').prop('disabled', true);
    $(this).parents('tr').find('.aaa').prop('disabled', false);
});</script>
Answer:2

You can use like,

$('.edit').click(function () {
    $(this).closest('tr').siblings("tr").find('.aaa').attr('disabled', true);
    $(this).closest('tr').find('.aaa').attr('disabled', false);
});
Answer:3

I am using testcafe version - 1.6.1 I am trying to apply an assertion to see if an element is clickable or not (expect to not be clickable). I've found the elements class name and a dynamic sibling ...

I am using testcafe version - 1.6.1 I am trying to apply an assertion to see if an element is clickable or not (expect to not be clickable). I've found the elements class name and a dynamic sibling ...

  1. hasclass doesn't work
  2. jquery hasclass doesn't work
  3. jquery doesn't hasclass

I have tried empty validation using ternary operator, but it's not returning data. Below is my json object var data = [ { "name": "test", "domain": "domain1", "subdomain": "...

I have tried empty validation using ternary operator, but it's not returning data. Below is my json object var data = [ { "name": "test", "domain": "domain1", "subdomain": "...

Is it possible to add eventListener with regex: Something like this: document.addEventListener(""+/\d+/+"", function (data) { }); Thanks!

Is it possible to add eventListener with regex: Something like this: document.addEventListener(""+/\d+/+"", function (data) { }); Thanks!

  1. addeventlistener regex

For example digits=4 means if input is 7 need output 7999, for 83 output should be 8399, for 9 output should be 9999. Want to add trailing 9 based on digits

For example digits=4 means if input is 7 need output 7999, for 83 output should be 8399, for 9 output should be 9999. Want to add trailing 9 based on digits