What are the best ways to structure or design text within a textarea field?

To display data in a textarea with a specific format, follow these guidelines:

Here is how the current UI should look like:

Below is the HTML code to achieve this:

<textarea disabled class="bgYellow" rows="6">{{text1}}</textarea>

And here is the corresponding Typescript Code:

  invoiceNo = '1000799758-00';
  status = 'Spark';
  palletLP = '';
  needAudit = 'NO';

  text1 = 'Invoice No.:  ' + this.invoiceNo + '\n' +
          'Status:  ' + this.status + '\n' +
          'Pallet LP:  ' + this.palletLP + '\n' +
          'Audit?:  ' + this.needAudit;

I am looking for help on how to align the "Invoice No." label to the left and its corresponding data to the right similar to Bootstrap grid style.

Answer №1

Remember to use the single backtick :

 variable1 = `
Item Name: Apple
Price: $2.00
Quantity: 3
...         : 4`
}

https://example.com

Answer №2

revise your code to

text1 =  ' Invoice Number: ' + this.invoiceNo + '\n' +
      '      Status: ' + this.status + '\n' +
      '   Pallet License Plate: ' + this.palletLP + '\n' +
      '      Needs Audit?: ' + this.needAudit;

After that, updating the text area to utilize a terminal (fixed width font) through css may potentially resolve the issue.

Altering The Font Of Text Area

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using jQuery or JavaScript to clear multiple selections in a multiselect dropdown when a button is clicked

Is there a way to clear the dropdown selections once my function saves data to local storage? You can refer to this fiddle for more details: http://jsfiddle.net/3u7Xj/139/ I already have code in place to handle other form elements: var $form = $("#formI ...

Development mode causing sluggish asset compilation

I am facing an issue with a large rails application that has hundreds of coffee script files. Whenever I make a small change in a coffee script file or switch branches, the entire assets need to be precompiled, causing a significant delay in loading the p ...

safari application is processing audio recordings with incorrect mime type as application/octate-stream

When attempting to capture a user's recording from a microphone using the Media Recorder API, everything works smoothly in Chrome. However, when trying to record in Safari, the MIME type is reported as application/octet-stream. I need to transmit the ...

Tips for adjusting UI size in CSS based on viewport dimensions and accommodating image content

https://i.sstatic.net/DMU5s.jpg The elements E1, E2, E3, E4 are all part of the user interface (UI) and are intended to have a hover effect. Additionally, there is a background image included in the design. Currently, this is the progress made on the pro ...

How to select the first column in a jQuery Datatable and turn it into checkboxes

I'm faced with a situation where I need to incorporate a checkbox column in a table, with the checkboxes appearing as Checked or Unchecked based on the values in the first column and its subsequent rows. The challenge lies in dealing with dynamic data ...

Display corresponding JSON images of items within an *ngFor loop in Angular

For my latest project, I am using Angular for the front-end and Laravel for the back-end. The issue I'm facing is with displaying images in Angular that are stored in Laravel storage. The image URLs are stored in the database in JSON format like this: ...

Transforming a Java applet into an <object> tag

After updating my Java to the latest version, I encountered a problem with an applet I regularly use. Despite adjusting the security settings to the lowest level through the Control Panel, the applet still fails to run correctly. Here is how the applet was ...

Trouble with CSS: struggling to remove the bullet point from the <li> tag

I have created a CSS style for the layout of my basic document: div#content li { font-size:95%; list-style-image:url(/css/bullet_list.gif); line-height:1.5; } Further down in another document, I've included a CSS file that defines .code ...

Error in React Native - Invalid component type provided

I'm encountering an issue while building a React Native app with Expo CLI. Every time I test it, I receive an error message. How can I troubleshoot and resolve this problem? Error: Element type is invalid: expected a string (for built-in components) ...

Improving the efficiency of CSS animations

Is it possible to improve the performance of CSS animation by preventing it from running when the animated object is not visible on the viewport? Thank you! ...

`How to transfer data from the original array elements to their offspring`

I am faced with an array containing various names: [ { name: "John", lastName: "Doe", children: [ { name: "Max", lastName: "" }, { name: "Jay&quo ...

jQuery SlideDown Navigation

Is there a way to implement jQuery code that will display dropdown menu options when the Trials link is clicked? Update: jQuery(document).ready(function () { $("a[href='http://sheep.local/cms/trials']").click(function(e){ e.prevent ...

Troubles with Geocoding functionality on Google Maps integration within Wordpress

I have a challenge where I want to utilize the title of a Wordpress post (a specific location) as a visible marker on a Google map. The code provided by Google successfully displays the map without any markers: <script>function initialize() { va ...

Disappearance of array data

I have been working on creating an array of objects with nested arrays, but I am facing an issue where data seems to go missing in the final step: const args_arr = []; const options_arr = []; let options = ''; let text = ""; for (let i = 0; ...

Is it advisable to switch the doctype from HTML 4.01 or XHTML 1.0 to HTML5 for a web page?

When updating a legacy website to be more modern and "HTML5"-ish, is it considered safe to simply change the heading doctype as shown below? <!doctype html> The original doctype could be: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitiona ...

What is the best way to ensure my arrow text remains properly positioned when using fullpage.js?

Seeking guidance from the web development community. I am currently working on a client's website that utilizes fullpage.js and encountering a persistent issue. On slide1 of the website, I am struggling to display the correct text next to the arrows. ...

Organizing JSON Data into Paragraphs

I'm working on a basic web application using Angular JS. Within my JSON object, I have several paragraphs that I need to split onto separate lines. I tried looking for a way to force a line break within the JSON object, but couldn't find a solut ...

Tips for avoiding word fragmentation in <pre> code blocks

pre { white-space: pre-wrap; /* CSS 3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ overflo ...

Issue found in Bootstrap-Multiselect plugin: The dropdown menu appears beneath the outer container when overflow-y is applied

My experience with using Bootstrap-Multiselect and encountering an issue where the dropdown disappears when the outer container has overflow-y: scroll and a max-height has prompted me to seek solutions. I am looking for a way to ensure that the dropdown is ...

Having trouble with Angular 7 routing to the same component with different parameters?

I currently have 2 router outlets available: the sidebar and the default one. {path: 'motor/:id', component: MotorComponent} Within the sidebar outlet, there are some router links that direct to the default router outlet, all pointing to the s ...