How do i create a table using Jquery

David Kleintjes

I want to make a error message when an error occurs,

HTML:

<div id="errorMessage"></div>

I want this table inserted into the div:

<table id="error" style="width:900px;border-top: 1px Solid #B7B7B7;border-right: 1px Solid #B7B7B7;
   border-left: 1px Solid #B7B7B7;border-collapse: collapse;background-color:#E7E7E7;height:auto;">
 <tr>
   <td style="color:#CC0000;">
     Een of meerdere verplichte velden ontbreken.
   </td>
 </tr>
</table>

I've tried this:

$("#errorMessage").append("<table id="error" style="width:900px;border-top: 1px Solid #B7B7B7;border-right: 1px Solid #B7B7B7; border-left: 1px Solid #B7B7B7;border-collapse: collapse;background-color:#E7E7E7;height:auto;"></table>");

    $("#error").append("<tr><td style="color:#CC0000;">Message</td></tr>

I cant find the correct way to do it can someone please help? Appreciated :)

PriyankMotivaras
<style type="text/css">
    #error{
        width:900px;
        border-top: 1px Solid #B7B7B7;
        border-right: 1px Solid #B7B7B7;
        border-left: 1px Solid #B7B7B7;
        border-collapse: collapse;
        background-color:#E7E7E7;
        height:auto;
    }
    .tdinsideError
    {
        color:#CC0000;
    }
</style>
<div id="errorMessage"></div>
<script type="text/javascript">
    var errorContent = '<table id="error"><tr><td class="tdinsideError">'+customMessage+'</td></tr></table>'; // if  custom message.
    var errorContent = '<table id="error"><tr><td class="tdinsideError">Een of meerdere verplichte velden ontbreken.</td></tr></table>'; // if no custom message.
    $(document).find("#errorMessage").html(errorContent);//method 1
    $(document).find("#errorMessage").html($("<table>").addClass("error").attr("id",'error'));//method 1
    $("<span>").addClass("fa fa-plus")
</script>
<!--
    <table id="error">
        <tr>
            <td class="tdinsideError">Een of meerdere verplichte velden ontbreken.</td>
        </tr>
    </table>
-->

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I create a table using the Spark Cassandra Connector?

How can I redo this code to do create the table, but using loops?

How do I create a table by using DataFrame & Index

How do I create a mysql table using a variable name in Python?

How do I create 5 JQuery AJAX calls using eventhandlers?

How do I select table row using Jquery?

How do i translate text in a table Using JQuery/Javascript?

How to create a table in database using jquery

SQL - How do I create a linkage table?

How do I create a dates table in Redshift?

How do I create a table with foreign keys?

How do I create a hash table in Java?

How do I create a dummy table in Quarto?

How do I create @OneToMany table in cassandra

How do I create a partitioned table in bigquery

How do I create this Table with html

How do I create a percentage counter in jQuery?

How do I create a textarea countdown with jQuery?

How do I create a jquery function with callbacks

How do I change the content of table cells using jQuery and then dynamically add more when I run out?

How do it table filter by date using jquery

How do I create a table using huxtable to produce a LATEX pdf output with knitr?

How do i create multi-field table relationships using vba?

How do I create and append data from csv file to big query and partition the table using python?

How do I create a Graph Node Table in SQL Server using SQL Alchemy?

how do i take a python pandas dataframe and create a new table using the column and row names as the new column

How do I create a table using 2D array in Java?

How do I create a triangle using JavaFX?

How do I create a folder using ExtendScript?