Change Caption Accordion with JS

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
slashmaster
Posts: 29
Joined: Fri May 25, 2018

28 May 2018

Hi,

it is possible, to change the Caption from an Accordion by Code (Displayform)?
Manuell i set the Title (or Caption?) to "old Caption" and the css-class named "cssAcc" and tried this code:

Code: Select all

$(".cssAcc").html($(".cssAcc").html().replace(/old Caption/,"new Caption"));
It displays the new Name, but the Accordion losts his functionality.

thx in advanced.

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

28 May 2018

Dear slashmaster,
Please, use the following code, it should work:

Code: Select all

$('.ui-accordion h3:contains("old Caption")').text('new Caption');
Cheers

slashmaster
Posts: 29
Joined: Fri May 25, 2018

28 May 2018

Dear Nikita,

thank u for ur fast Response. The good News: it works - i can expand or Close the Accordion. The Bad News: the Arrow (wich is showing expand/Close) is missing... Any ideas? :)

ty :)

User avatar
Nikita Kurguzov
Posts: 889
Joined: Mon Jul 03, 2017

28 May 2018

Dear slashmaster,
Here, try this instead then:

Code: Select all

var newText = $('.ui-accordion h3:contains("old Caption")').html().replace("old Caption", "New Caption");
$('.ui-accordion h3:contains("old Caption")').html(newText);
Cheers

slashmaster
Posts: 29
Joined: Fri May 25, 2018

29 May 2018

Good Morning Mr. Nikita :)
incredible, it works fantastic.
Thank u very very much! :)

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests