0

I have tried to set up an onchange event to be triggered on a Multiline (Plain) Text field. I have tried all the following without luck.

$("textarea[Title='Identified Tasks']").closest("span").find("iframe[Title='Rich Text Editor']").change(function(){
alert('Action 1');});

$($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).bind('input', function() {
alert('Action 2');});

$($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).on('input', function() {
alert('Action 3');});

$("input[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']").change(function(){
alert('Action 3');});

$($("input[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).change(function(){
alert('Action 4');});

$("textarea[Title='Identified Tasks']").closest("span").find("iframe[Title='Rich Text Editor']").contents().change(function(){
alert('Action 5');});

$("textarea[Title='Identified Tasks']").closest("span").find("iframe[Title='Rich Text Editor']").change(function(){
alert('Action 6');});

$("textarea[Title='Identified Tasks']").closest("span").change(function(){
alert('Action 7');});

$("textarea[title='Identified Tasks']").change(function(){
alert('Action 8');});

$($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).change(function(){
alert('Action 9');});

$($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).closest("span").change(function(){
alert('Action 10');});

$($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).children().change(function(){
alert('Action 11');});

$($("[id^=Identified_x0020_Tasks]")[0]).change(function(){
alert('Action 12');});

var systemDescriptionRTE = $("textarea[Title='Identified Tasks']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body"); 

ar systemDescriptionRTE = $("textarea[Title='Identified Tasks']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("body").find("span");
    $(systemDescriptionRTE).change(function(){
alert('Action 13');});

$("textarea[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']").change(function(){
alert('Action 14');});

$("textarea[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte'][0]").change(function(){
alert('Action 15');});

$("textarea[title='Identified Tasks']").change(function(){
alert('Action 16');});

$slogDiv.on('change', function(e){
alert('Action 18');});

var $slogDiv = $("[id^='Identified_x0020_Tasks'][id$='$TextField_inplacerte']");

  $slogDiv.on('change', function(e){
alert('Action 20');});

The following code does work

var $slogDiv = $("[id^='Identified_x0020_Tasks'][id$='$TextField_inplacerte']");

 $slogDiv.on('click keyup', function(e){
alert('Action 19');});

alert($($("[id^=Identified_x0020_Tasks][id$='$TextField_inplacerte']")[0]).text())

So I seem to have the selector correct. Any ideas on how to attach a change event on it?

The clickup event does work, but multiple times, not just once as expected from a change event.

Any suggestions on what coding I need?

4
  • Are you working on Modern Page or Classic Page? Commented Sep 6, 2019 at 5:29
  • Standard on-premise Sp2013 newform and editform...
    – southskies
    Commented Sep 6, 2019 at 6:46
  • I tried with $slogDiv.on('change', function(e){alert('Action 20');}); and it is working fine. Commented Sep 6, 2019 at 7:26
  • Arrggghh.. no this won't fire on my page!
    – southskies
    Commented Sep 6, 2019 at 8:07

1 Answer 1

0

I was unable to get this to work. Ended up modifying the presaveaction section and in this section did a before / after comparison of the field and did a jQuery update on that field if a change had been detected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.