Split label in Fluent Forms by delimiter

tdrayson

Javascript

        var labels;
var split_labels = [];
var labels_arr = [];


$(".ff-el-input--content > .ff-el-form-check > .ff-el-form-check-label > span").each(function(i, el){

   labels = $(this).text();

   split_labels = labels.split('-');
   
   $(this).html("<span class='left-text'>" + split_labels[0] + "</span><span class='middle'> - </span><span class='right-text'>" + split_labels[1] + "</span>")

});
for(var i = 0; i < labels_arr.length; i++){
    $(".ff-el-input--content > .ff-el-form-check > .ff-el-form-check-label > span("+i+")").html(labels_arr[i]);
}
      
Copy

👋🏻 Weekly Tutorial Digest

I send out a weekly newsletter with links to new tutorials written in the last week, you can subscribe below.

Newsletter

🔒I won't send you spam, I promise