I have this JavaScript code for my SharePoint forms which does not work in other browsers but works in Internet Explorer.
By using jQuery, when you initially open the task, the Rejected button will be shown as disabled and it will only enable when you add comments.
$(document).ready(function(){
var reject = "input[name='Status_c15b34c3-ce7d-490a-b133-3f4de8801b76_$DropDownChoice_Rejected']";
var tooltip = 'Please enter comments to reject the task';
$(reject).attr('title',tooltip);
$(reject).attr('disabled','disabled');
$("textarea[Title='Append-Only Comments']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body").keyup(function(){
disableReject();
});
function disableReject(){
var comments = $("textarea[Title='Append-Only Comments']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body").find('div').text().trim().length;
var reject = "input[name='Status_c15b34c3-ce7d-490a-b133-3f4de8801b76_$DropDownChoice_Rejected']";
if(comments > 0){
$(reject).removeAttr('disabled');
}
else{
$(reject).attr('disabled','disabled');
}
}
});
Can you please check the code and let me know the changes to be made to work in chrome
$(reject)
result rather than re-querying each time.