Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have form where multiople apply button and have uniq id for every button

<button class="btn " type="button" id="@item.JobId'_Apply'" name="action" onclick="Apply(@item.JobId,'@item.DesignationName')"> Apply
                                   </button>



button click i want to disable perticular button


but it's not work now

What I have tried:

 $("#" + id + "_Apply").attr("disabled", true);
$(this).attr("disabled", true);
Posted
Updated 21-Nov-17 19:10pm
Comments
Kornfeld Eliyahu Peter 20-Nov-17 2:59am    
You have to show a more complete code here - we can not decide from that what this is and why it went wrong...
F-ES Sitecore 20-Nov-17 5:56am    
It probably didn't work because you are adding apostrophes to the id. Change

id="@item.JobId'_Apply'"

to

id="@(item.JobId)_Apply"

1 solution

pass the button object (this) to the Apply method
JavaScript
onclick="Apply(this,@item.JobId,'@item.DesignationName')">


JavaScript
function Apply(obj, jobId, designationName) {
            obj.disabled = true;
            // your code
        }
 
Share this answer
 
v2
Comments
Afzaal Ahmad Zeeshan 20-Nov-17 3:24am    
5ed.
Karthik_Mahalingam 20-Nov-17 3:29am    
Thank you AAZ
Jaydeep Shah 20-Nov-17 3:42am    
Grate solution
Karthik_Mahalingam 20-Nov-17 3:48am    
Thank you Jaydeep

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900