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 8255315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:28:51+00:00 2026-06-08T01:28:51+00:00

There is a HTML element of type text whose name is fiche_tache_ref. Inside a

  • 0

There is a HTML element of type text whose name is fiche_tache_ref. Inside a javascript file (.js) outside of the page’s folder I want to set its value according to the value of a listbox selected :

function changerNatureRefTache(nature_tache_id) { // nature_tache_id is from a listbox

    var http_ajax = $('#http_ajax').val();
    var html = $.ajax({
    data: "nature_tache_id="+nature_tache_id ,
    type: "POST",
    url: http_ajax+"referentiel/AjaxTacheChangerNatureTache.php" ,  
    async: false
    }).responseText;

        // here I want to set the value of the field

}

Code of AjaxTacheChangerNatureTache.php is :

<?php
    if (isset($_POST['nature_tache_id'])) {
        define("ROOT_PATH", "../../");
        require_once ROOT_PATH  . 'config.inc.php';
        require_once RP_MODELS  . 'nature_tache.class.php';
        $db     = new DbConn();
        $obj    = new nature_tache($db->getInstance());
        $ret    = $obj->recupererNatureTache($_POST['nature_tache_id']);
        $code   = $ret['nat_code'];
        echo $code;
    }
?>

So how to set the value of the field using JQuery ?

  • 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-06-08T01:28:53+00:00Added an answer on June 8, 2026 at 1:28 am

    Use the val() function

    $('#idofinput').val("text you want in the field");
    

    Since you are using name you can do the following

    $('input[name=fiche_tache_ref]').val("text you want in the field");
    

    Since names are not necessarily unique be careful with using the name as a selector. I would generally advise using an id instead.

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

Sidebar

Related Questions

I have this sample page: <html> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8> <title>Ajax Page</title> <script
Possible Duplicate: Finding whether the element exists in whole html page Is there any
Is there anyway to retrieve a HTML element's class or ID in the controller
Is there any way to position one of your HTML element related to the
Why is there a reported difference in element heights given the following html? <span
Is there a way to clone HTML elements using JQuery? However, I want to
Is there any html form class(text box) that does not allow null values. The
Is there an event for situations where something is selected on an HTML page
I want to create a input textbox that does not require a <input type=text>
I have a javascript object called 'element' of type HTMLInputElement that corresponds to a

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.