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 :)
<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.
Comments