I am appending a variable from an input to a li. I want to trim the P <p class="layer' + count + '"> '+ Xia2 +'</p>
text to a number of 15 characters and not trim the SPAN, witch uses the same Xia2 variabile. I can probably create 2 variabiles for this...
How can this be done? I've tried several ways trying the $(this).val(text.substr(0, 5));
Here is my append code:
Xia2 = $(this).val();
$("#detailes ul").append('<li class="n' + count + '"><input class="layer' + count + '" type="checkbox"><input class="lock ' + count + '" type="checkbox"><input class="del ' + count + '" type="checkbox"><p class="layer' + count + '"> '+ Xia2 +'</p></li>');
$('<span id="layer' + count + '">'+ Xia2 +'</span>').appendTo('#selectable1');
Thank you.