skip to Main Content

I’m trying to display the value that is stored in the variable
$('#view-property .imo_desc_site').html(${property.imo_desc_site});

In my textarea, but I’m not getting it.

What could I be doing wrong?

<div class="col-md-12" style="margin-bottom: 0px !important">
                                <div class="form-group">
                                    <label for="imo_desc_site" style="margin-bottom: 10px;">DESCRIÇÃO DO IMÓVEL - EM BREVE</label>
                                    <textarea readonly rows="15" class="form-control no-resize" style="border: 1px solid #7777774a; border-radius: 10px;">
                                        <span class="imo_desc_site">
                                    </textarea>
                                </div>
                            </div>

2

Answers


  1. In the provided HTML code, it seems like you are trying to display the value stored in the variable $(‘#view-property .imo_desc_site’).html(${property.imo_desc_site}); within a element inside the textarea. However, this approach won’t work as expected because a element cannot contain HTML tags or nested elements.

    To display the value in the , you can directly set the value attribute of the textarea using PHP code. Here’s an example of how you can achieve this:

        <div class="col-md-12" style="margin-bottom: 0px !important">
            <div class="form-group">
                <label for="imo_desc_site" style="margin-bottom: 10px;">DESCRIÇÃO DO IMÓVEL - EM BREVE</label>
                <textarea readonly rows="15" class="form-control no-resize" style="border: 1px solid #7777774a; border-radius: 10px;"><?php echo $property['imo_desc_site']; ?></textarea>
            </div>
        </div>
    

    Make sure that the $property[‘imo_desc_site’] variable is properly assigned with the desired value on the backend side before rendering the HTML.

    This code snippet will correctly display the value from CI in the textarea.

    Login or Signup to reply.
  2. What I understood is that you’re trying to add some default text in a textarea, to achieve that, you don’t need a span nested inside text area.
    Here i’m assuming that you have a variable in your PHP file with name $imo_desc_site, and the text that you want to add in your textarea, is stored in that ($imo_desc_site) variable.
    Now to add that text to your textarea, you just have to echo that text between opening and closing tag of your textarea.

    <div class="col-md-12" style="margin-bottom: 0px !important">
        <div class="form-group">
            <label for="imo_desc_site" style="margin-bottom: 10px;">DESCRIÇÃO DO IMÓVEL - EM BREVE</label>
            <textarea readonly rows="15" class="form-control no-resize" style="border: 1px solid #7777774a; border-radius: 10px;">
                <?php echo $imo_desc_site; ?>
            </textarea>
        </div>
    </div>

    echo statement in PHP is used to show output on HTML page.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search