如何获取值的live的输入元素的值

时间:2022-11-28 08:35:57

HI,

HI,

 i am having a Input hidden element like

in my JQuery i am setting the value for the above input type after some ajax call like

在我的JQuery中,我在一些ajax调用之后设置了上述输入类型的值

EDIT:::

编辑:::

                      $.ajax({
        type: "POST",
          url: "http://localhost/FormBuilder/index.php/forms/saveForm/",
                       async: false,
        data: "formname="+formname+"&status="+status,
                                                         success: function(msg){$("#FormID").val(msg); }//success

                 });//ajax

Now somewhere in the code after this i want to fetch the value of this FIeld.How to get this value on live of value for this input type..

现在在代码中的某处,我想获取此FIeld.How的值,以获得此输入类型的值的值。

EDIT::: i am retriving like by var FORMID=$("#FormID").val();//but shows null

编辑:::我正在通过var FORMID = $(“#FormID”)。val(); //进行重新审核但是显示为null

How to get the value of it on live of this Input element

如何在此Input元素的实时中获取它的值

3 个解决方案

#1


0  

To get a value, you just have to call the val function without arguments:

要获取值,您只需调用不带参数的val函数:

var value = $("#FormID").val();

#2


0  

Try var FORMID=$("#FormID").val()

尝试var FORMID = $(“#FormID”)。val()

#3


0  

as per @CMS described i write the complete code below

按照@CMS描述,我写下面的完整代码

$.ajax({
        type: "POST",
        url: "http://localhost/FormBuilder/index.php/forms/saveForm/",
        async: false,
        data: ({ formname:formname,status:status }),
        success: function(){
            var value = $("input[type=hidden][name=xxx]").val();
        }
})

#1


0  

To get a value, you just have to call the val function without arguments:

要获取值,您只需调用不带参数的val函数:

var value = $("#FormID").val();

#2


0  

Try var FORMID=$("#FormID").val()

尝试var FORMID = $(“#FormID”)。val()

#3


0  

as per @CMS described i write the complete code below

按照@CMS描述,我写下面的完整代码

$.ajax({
        type: "POST",
        url: "http://localhost/FormBuilder/index.php/forms/saveForm/",
        async: false,
        data: ({ formname:formname,status:status }),
        success: function(){
            var value = $("input[type=hidden][name=xxx]").val();
        }
})