开发者

How to access javascript value in jsp?

开发者 https://www.devze.com 2023-01-28 03:19 出处:网络
Hi i am using jquery. like, <script type=\"text/javascript\"> $(function() { $(\'#usertype\').change(function() {

Hi i am using jquery. like,

 <script type="text/javascript">

$(function() {

         $('#usertype').change(function() {
                $.post("<%=request.getContextPath()%>/CommonServlet", {utype:$('#usertype').val(),funName:'getConfigMast'},  function(j){
                 $("input#it").html(j);alert(j);

             });
         });
 });

</script>

in this j contians some model object i have to iterate his object in my same jsp page and those values i have to show in text fields in <table>. here the jquery function will called when i selected the the value from combobox of same <table>

and jsp table:

<table >    
    <tr>
      <td><input name="filetype" type="text" class="formTxtBox_1" id="filetype"/></td>
    </tr>
    <tr>      
      <td>
          <select name="usertype"  id="usertype" >
            <option >- Select Type of User -</option>
            <option value="admin">开发者_JAVA百科 administrator </option>
            <option selected="true" > normal</option>
            <option> member</option>
          </select>      </td>
    </tr>
 <tr>  
   <td><input name="singlefile" type="text" id="singlefile"/></td>
    </tr>
 <tr>
   <td><input name="totalfile" type="text"  id="totalfile"/></td>
    </tr>
<table>


The value of an input field needs to be set using val() function, not html().

$('#singlefile').val(value);
0

精彩评论

暂无评论...
验证码 换一张
取 消