dimanche 7 février 2016

How to set the phone number in hidden field, and then get that hidden value and set it on changing the dropdown

I want to autofill a integer field with a phone number of users whenever thier name is selected in the dropdown.I have an jquery onchange function(of dropdown)where the both values is in the same page and we can get and set the value anywhere in that page using jquery.But this code is not applicable in my case because the phone number diplayed field is in other page and dropdown in another page.The field which is to be autofilled is in the same page of dropdown.Now How do i get the Phone number of corresponding users selected from dropdown.

Below is the juery code

<%= javascript_tag do %> 
$(document).ready(function() {
  $("#issue_custom_field_values_119").change(function() {
    var selOption = $(this).val();
var test = $("table.person tr td.phones").text();    
alert(test);
    $("#phones").val(parseInt($("#num-" + selOption).text()));
  });
});
<% end %>

Aucun commentaire:

Enregistrer un commentaire