how to display specific number of letters of paragraph in HTML [duplicate] - html

This question already has answers here:
How can I set a character limit for paragraph?
(2 answers)
Closed 16 days ago.
I'm looking for solution to shortening paragraph in HTML
Let's say I have a paragraph
<p>This is some text</p>
Now what I want to know is how can I make this paragraph show less lines. For example instead of showing full paragraph it shows only first 4 characters which results in
<p>This</p>

I think you're looking for something like this: https://jedfoster.com/Readmore.js/
If you wanted to do it manually just store the text in globably js variable like:
var pText = "Some really long text that you want to shorten or lengthen on a click";
$(".showMore").toggle(function() {
//full text case
$(".myParagraphElement").html(pText);
// collapsed case, replace 50 with the number of characters you want
$(".myParagraphElement").html(pText.substring(50));
});

Related

How can I make spaces after numbers stay in place in HTML? [duplicate]

This question already has answers here:
How to put spaces between text in html?
(6 answers)
Closed 2 years ago.
I am having an issue with double spaces after dotted numbers as follows.
Suppose I put the following text in HTML, I get a space issue.
1. Box 1
The output should be:
Box 1
However, I get the following:
Box 1
Even when using margins, I get the same problem.
An actual example is below.
In Word:Permanent deletion:
Click on the drop-down menu that displays, ‘Keep in Inbox’.
Click on, ‘Discard’, on the menu.
In HTML:
Permanent deletion:
Click on the drop-down menu that displays, ‘Keep in Inbox’.
Click on, ‘Discard’, on the menu.
Same text but in HTML.
How can I retain the second space after the number for each instance?
If you want more than one space in html, you need to use the non-breaking space character entity

Change Title with Octave imshow() [duplicate]

This question already has answers here:
How to change the window title of a MATLAB plotting figure?
(4 answers)
Closed 3 years ago.
Octave imshow() will display the image but the title of the image as "Figure 1", How can I change the title.
You can add your own title to a figure window's title bar by setting the Name property to the desired title and you can turn off the figure number by setting the NumberTitle property to 'off' as follows:
title ("imshow with random 100x100 matrix");
see document for more

div ignore start spaces and more then 1 space [duplicate]

This question already has answers here:
How to show the text with Line Breaks
(6 answers)
Closed 5 years ago.
the problem is that every space char at the start of the text is being discarded and every second space char afterwards is being discarded as well.
this is the example, treat every '_' char as "space" because it happening here as well:
text : "____a_a__a_______a"
visual : "a a a a"
the part of the angular 2 code that rendering the text is this:
<div #refId class = 'line_counter' [ngStyle]=setStyles()>
{{getData()}}
</div>
the solution i thought of is using some predefined char and render it as transparent but im really hopping that some one could help me with a real solution?
You cannot perform blank spaces inside the IDE and expect to visual it while running.
You must add &nbsp to your text value, this way you will be able to see it.
You can use this HTML entity:
this stands for "non-breaking space", and you can put as many after each other as you like.

CkEditor : how to get actual text size without HTML tags

How to get text size in CkEditor without all HTML tags? I want to restrict user not to exceed certain text length and want to display correct message with actual length of entered text. CKEDITOR.instances.TextAreId.getData().length returns the length of text with HTML tags.
I know I can achieve this using regular expressions but if there is already something then I would prefer that.
Thanks.
There are is a Word Count plugin for CKEditor that may help you as well. It displays the number of characters and words.
Another way to get the text length inside the CKEditor instance, is to use this code:
var length = CKEDITOR.instances.myCKEditor.document.getBody().getText().length;

How to change text width on a AppBarButton in Windows Phone 8?

I don't want this single letter 'e' to break to the next line. Instead, I want a single word.
Does anyone have an idea how to accomplish this?
There is no way to change the max. length (11 characters) of the ApplicationBarIconButton description text.
More information: Application bar icon text length.