I want to extract data from the list and put it in the form using jquery!

I succeeded to know how to import data from "Last Name" and "First Name" of the list into text fields "Last name" and "First name" of the form by

<input type="text" id="lastname"/>

var x="";
x = x + x.get_item('Last_x0020_Name');

I still have problem on select field (Age) and textarea filed (description)

enter image description here

  • Do you know the id for the Age field? Is the select field (Age) pre-populated or just or just get the options from the list? – cubanGuy Aug 14 '14 at 16:34

Try this:


<label for="ageList">Age from List</label>
<input type="text" id="ageList" />
<label for="ageForm">Age from Form</label>
<input type="text" id="ageForm" />
<label for="myselect">Age Dropdown</label>
<select id="myselect">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>


$('#ageList').on('keyup', function () {
var theText = $("#ageList").val().toString();
$('#myselect option[value]').each(function () {
    if ($(this).attr("value") === theText) {
        $(this).attr("selected", "selected");



The HTML code is just for reference, I'm sure yours is totally different. I hope this helps.

  • Thanks. My question now is how to remove a subsrting from a string. For exemple, when i extract data from a textarea , it appears to me the text that i want and also the balise like this div my text div so i want to delete div and div – user32312 Aug 15 '14 at 8:58
  • If I understand your question correctly, to remove a substring from a string, one option would be to use replace(). check this link – cubanGuy Aug 15 '14 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.