This topic is locked
[SOLVED]

How to split a button label into two parts

8/22/2024 10:55:12 AM
PHPRunner General questions
J
Jan author

example :
Adam Smith should be :

Adam
Smith

What code do you need for this?Thanks.

Davor GeciDevClub member 8/22/2024

You need to provide more details. Where do you need this, in a list, in a view, edit. Are you talking about the label or about the field (names are presented in a field, in label there is a description of the field)

img alt

J
Jan author 8/23/2024

clarification:

I use a custom button, in the javascript onload event I write this code:

$("span[data-itemid=custom_button1]").find("a").text("Adam Smith");

result :

img alt

I want to place the first name and the last name below each other on the button, what should I change in the code above? Thanks.

C
cristi 8/23/2024

use "html" instead of "text" - this way you can use the "<br/>" tag:

$("span[data-itemid=custom_button1]").find("a").html("Adam <br/>Smith");
J
Jan author 8/23/2024

Thanks for the code. Works great.