Why are Divs not shown inside the DIv?

0

The problem is that the DIVS that the shekel gives me does not show its text but the block and outside the div of Category as seen in the image

Index.php

Esto esta dentro de una function yo trabajo con plantillas de php 

//Dentro del cuerpo Usuario
$html .='
        <div id="campoBusq"></div>
            <div id="categoria">';
                include("selectCategJquery.php");

$varHtml .='</div>
       </div>';//Fin del Cuerpo Usuario

selectCategJquery.php

<?php 
    include('../configuracion/conexion.php'); 
?>

<?php 
    $consulta = "SELECT idCategoria FROM buscar_categoria";
    $resultado = $conexion->query($consulta) or die("Error de busqueda o conexion");

    $contador = 0;
    while ($datosCateorias=$resultado->fetch_assoc() ) {
        $contador++;
        echo "<option class='elemento ".$contador."' iden='".$contador."'>". $datosCateorias['idCategoria']."</option>";
    }



    mysqli_free_result($resultado);
    $conexion->close();
?>
    <script>

        jQuery(document).ready(function() {

            $('#categoria').on('click','.elemento',function() {
               var e = $(this).clone();
               var identificador = $(this).attr("iden");

               if($("#campoBusq").find("."+identificador).length){

               }else{
                 $(e).appendTo('#campoBusq');
               } 
           });


            $('#campoBusq').on('click','.elemento',function() {
               $(this).remove();
            });

        });
  </script>

Image of the Execution

    
asked by Gamez 10.03.2017 в 23:05
source

2 answers

1

You have an extra closed div. Take it off, it should look like this:

<div id="campoBusq"></div>
<div id="categoria">
     include("selectCategJquery.php");
</div>

EDIT In:

$varHtml .='</div>
       </div>';

Remove one:

$varHtml .='</div>';

EDIT !!

I'm not sure if it will work but theoretically it should.

Change this part like this:

while ($datosCateorias=$resultado->fetch_assoc() ) {
        $contador++;
        $html.= "<option class='elemento ".$contador."' iden='".$contador."'>". $datosCateorias['idCategoria']."</option>";
    }

The options concatenate them to the variable $ html where you have the divs. I had not noticed how you used it.

    
answered by 10.03.2017 / 23:08
source
0
function body(){
    $varHtml ='<body class="centB">';

        if (isset($_SESSION['administrador'])) {
            if (isset($_GET['index']) ) {
                $varHtml .='<header>';
                $varHtml .='
                        <img class="clashImg"src="../fotos/clashofclans_paralax2.jpg">
                        <div id="menu">
                            '.$menu = menu().'
                            <div id="titulo">
                                <img src="../fotos/clashofclans_logo.png">
                                <h2>Trueque</h2>
                            </div>
                            '.$notaPortada = notaPortada().'
                        </div>

                    ';
                $varHtml .='</header>';

                $varHtml .='<div id="cuerpoUsuario">
                                <div class="herramientasMnCont">
                                    <div class="herramientasMn centFRH">

                                        <div class="caj1-HMn1 buscarHMn">
                                            <div class="imgBuscarHMn">
                                                <img src="../css3/fonts_icons/buscar.svg" >
                                            </div>
                                            Buscar Aldeas
                                        </div>

                                        <div class="caj1-HMn1">
                                            <div class="imgBuscarHMn">
                                                <img src="../css3/fonts_icons/vender.svg" >
                                            </div>
                                            Vender Cuenta
                                        </div>

                                        <div class="caj1-HMn1">
                                            <div class="imgBuscarHMn">
                                                <img src="../css3/fonts_icons/cuentasEVenta.svg" >
                                            </div>
                                            Tus Cuentas en Venta
                                        </div>

                                        <div class="caj1-HMn1">
                                            <div class="imgBuscarHMn">
                                                <img src="../css3/fonts_icons/ultimPublicaci.svg" >
                                            </div>
                                            Ultimas Publicaciónes
                                        </div>

                                    </div>
                                </div>*Aqui esta el problema del Debate*
                                <div id="campoBusq"></div>
                                <div id="categoria">';
                                    include("selectCategJquery.php");

                    $varHtml .='</div>
                            </div>';//Fin del Cuerpo Usuario


            }else{
                $varHtml = '
                    <header>
                        '.$menu = menu().'
                        <div id="subLogo" class="centFRV">
                            <img src="../fotos/clashofclans_logo.png">
                            <h2>Trueque</h2>

                        </div>
                    </header>
                ';
            }
            echo $varHtml;

        } 
            echo $varHtml;


} 
    
answered by 10.03.2017 в 23:42