Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4533140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:07:07+00:00 2026-05-21T14:07:07+00:00

im new using jquery with django. Im trying to inform the user if the

  • 0

im new using jquery with django. Im trying to inform the user if the email introduced is available or not, using ajax and jquery.

This is the section of interest from the original template before any javascript:

<form action="/registro/usr/solicitud/" method="post" name="solicitud"> 
    <div style='display:none'><input type='hidden' name='csrfmiddlewaretoken' value='08f46536def8682c7fef57e3e86dfd38' /></div> 
    <table id="tabla_solUsr"> 
        <tr><th><label for="id_username">Nombre de usuario:</label></th><td><input id="id_username" type="text" name="username" maxlength="30" /><br /><span class="helptext">Requerido. 30 caracteres o menos. Letras, dígitos y @/./+/-/_ solamente.</span></td></tr> 
        <tr><th><label for="id_password1">Contraseña:</label></th><td><input type="password" name="password1" id="id_password1" /></td></tr> 
        <tr><th><label for="id_password2">Contraseña (confirmación):</label></th><td><input type="password" name="password2" id="id_password2" /><br /><span class="helptext">Introduzca la misma contraseña que arriba, para verificación.</span></td></tr> 
        <tr><th><label for="id_email">E-Mail:</label></th><td><input type="text" name="email" id="id_email" /><br /><span class="helptext">Introduzca un e-mail válido. La confirmación de su solicitud se enviará a este correo.</span></td></tr> 
        <tr><th><label for="id_nombre">Nombre:</label></th><td><input id="id_nombre" type="text" name="nombre" maxlength="50" /></td></tr> 
        <tr><th><label for="id_apellido">Apellido:</label></th><td><input id="id_apellido" type="text" name="apellido" maxlength="50" /></td></tr> 
        <tr><th><label for="id_ci">Cédula de identidad:</label></th><td><input id="id_ci" type="text" name="ci" maxlength="8" /></td></tr> 
        <tr><th><label for="id_carnet">Carnet:</label></th><td><input id="id_carnet" type="text" name="carnet" maxlength="7" /></td></tr> 
        <tr><th><label for="id_oficina">Oficina:</label></th><td><input id="id_oficina" type="text" name="oficina" maxlength="8" /></td></tr> 
        <tr><th><label for="id_telefono">Telefono:</label></th><td><input id="id_telefono" type="text" name="telefono" maxlength="12" /></td></tr> 
        <tr><th><label for="id_dpto">Departamento:</label></th><td>
            <select name="dpto" id="id_dpto"> 
                <option value="" selected="selected">---------</option> 
                <option value="2">(CO) Cómputo Científico</option> 
                <option value="3">(CI) Computación y Tecnología de la Información</option> 
                <option value="4">(MA) Matemáticas</option> 
                <option value="6">(MC) Mecánica</option> 
                <option value="7">(FS) Física</option> 
            </select>
        </td></tr> 
    </table> 
    <button type="button" style="margin-left:190;margin-right:auto;width:137px;height:21px" id="newDtpo" class="flip">Nuevo Departamento</button> 
    <input type="submit" value="Registrase" /> 
</form>

This is my attempt to do what i mentioned:

$(document).ready(function(){
    $("#tabla_solUsr tr:first").append('<span id="usrSt" class="usrSt"></span>');
    $("tr:nth-child(4n)").append('<span id="emailSt" class="emailSt"></span>');

    $("#id_username").keyup(function(){
       // Grab what has been introduced and ask the server through ajax; then, show the result 
    });

    $("#id_email").keyup(function(){
       // Grab what has been introduced and ask the server through ajax; then, show the result
    });
});

The actual troublesome line is:

$("tr:nth-child(4n)").append('<span id="emailSt" class="emailSt"></span>');

Im trying to grab the fourth ‘tr’ tag in my document,

<tr><th><label for="id_email">E-Mail:</label></th><td><input type="text" name="email" id="id_email" /><br /><span class="helptext">Introduzca un e-mail válido. La confirmación de su solicitud se enviará a este correo.</span></td></tr>

and i thought that would be the correct way. I cant give it an id, a name, or a class, because this is dynamically generated by django.

instead of grabbing what i expected, i get the fourth ‘tr’ tag, and the fourth ‘tr’ tag after that one:

<tr><th><label for="id_email">E-Mail:</label></th><td><input type="text" name="email" id="id_email" /><br /><span class="helptext">Introduzca un e-mail válido. La confirmación de su solicitud se enviará a este correo.</span></td></tr>

and

<tr><th><label for="id_carnet">Carnet:</label></th><td><input id="id_carnet" type="text" name="carnet" maxlength="7" /></td></tr>

Is there any way to grab just the tag i need? why is this happening? id like to know what’s happenning so i can understand the way selectors work…

I apologize for my english, and hope a you can help me! thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:07:07+00:00Added an answer on May 21, 2026 at 2:07 pm

    You could alternately do something like

    $("label[for='id_email']").parent().parent().append(...
    

    I think this would be more readable and more robust when someone changes your page later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to javascript/jquery and having a hard time with using this or $(this) to
I'm trying to learn some basic ajax using Django. My simple project is an
So I am pretty new to both Django and Javascript (I am using JQuery)
Sorry, I am still new using jquery so this might be an easy question.
I've cleared a row and then added new cells using jQuery. This works fine
sing django and jQuery I am trying to implement a button that, using the
so I am new to using jquery .post() however I am not using methods
I am relatively new to using jQuery and would like to use the load
I just set up my new homepage at http://ritter.vg . I'm using jQuery, but
Using the jQuery UI Tabs component, is it possible to select new tabs on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.