I'm trying to add an HTML code to my HTML via jQuery, while any text works, already with a non-bootstrap tag For example:
$(function($){
$('#enviar').click(function (e) {
var linhas = $('#linhas').val();
var plantas = $('#plantas').val();
var combo=$('#haoum').val();
var resultado=Number(linhas)+Number(plantas);
$("#tam").attr("value", resultado);
if ( combo=="ha" ) {
$("#divPrincipal").append("Teste");
}
else
{
}
});
When I run the code, a test appears between these tags:
<div id="divPrincipal">
</div>
But when I put it for example:
$(function($){
$('#enviar').click(function (e) {
var linhas = $('#linhas').val();
var plantas = $('#plantas').val();
var combo=$('#haoum').val();
var resultado=Number(linhas)+Number(plantas);
$("#tam").attr("value", resultado);
if ( combo=="ha" ) {
$("#divPrincipal").append("<p class="text-success">Teste</p>");
}
else
{
}
});
Does not work, is there any function other than 'append'?