KevinCasoco / waste-disposal-tracking-system

Waste Disposal Tracking System for District 3 of Caloocan City our capstone project.
https://wastedisposaltrackingsystem-2024.com/
1 stars 0 forks source link

mobile-no-design-calendar-update-profile #99

Closed KevinCasoco closed 6 months ago

jaytzy024 commented 6 months ago

break word for new line // Assuming eventTitle is "Congressional Road" var maxLength = 10; // Adjust this value according to your needs

            // Check if the eventTitle length exceeds the maximum length
            if (eventTitle.length > maxLength) {
                // Split the eventTitle into words
                var words = eventTitle.split(' ');
                // Concatenate the first word with a line break after it, and join the rest of the words
                var truncatedTitle = words[0] + ' <br>' + words.slice(1).join(' ');
                // Assign the truncated title with Tailwind CSS classes to ensure line break
                var truncatedTitleWithBreak = '<span class="whitespace-normal break-words" style="cursor: pointer;">❌</span> ' + truncatedTitle;
                // Assign the truncated title with line breaks to the innerHTML of the span element
                eventElement.innerHTML = truncatedTitleWithBreak;
            } else {
                // If the length is within the limit, simply assign the eventTitle to the innerHTML
                eventElement.innerHTML = '<span class="whitespace-normal break-words" style="cursor: pointer;">❌</span> ' + eventTitle;
            }