javascript TypeError: 'stepUp' 在未在 jquery 中实现接口 HTMLInputElement 的对象上调用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22656598/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 23:31:46  来源:igfitidea点击:

TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement in jquery

javascriptjqueryajaxjquery-post

提问by Manju

I am calling the php file using jquery $.post method.At the time of the retriving the data I am getting an error.

我正在使用 jquery $.post 方法调用 php 文件。在检索数据时出现错误。

I did search on google,found 4 to 5 solutions but those are not working.

我确实在谷歌上搜索过,找到了 4 到 5 个解决方案,但这些都不起作用。

Please help me.

请帮我。

this is my code,

这是我的代码

Jquery

查询

 $(document).ready(function(){

 $("[name='side_door_on_size']").click(function (){
        var side_door_on_size=$(this).val();
        $.post('<?php echo get_home_url(); ?>/wp-content/plugins/thermax/filter.php',
               {side_door_on_size:side_door_on_size}, 
               function(data){
                  alert(data);
              });
       })
  })

Html

html

<input type="radio" name="side_door_on_size" class="side_door_on_size" id="side_door_on_size" value="25m"/>25m

回答by Girish

Please add element name in jQuery selector $("input[name=side_door_on_size]"),

请在 jQuery 选择器中添加元素名称$("input[name=side_door_on_size]")

try this code

试试这个代码

$(document).ready(function(){

 $("input[name=side_door_on_size]").click(function (){
        var side_door_on_size=$(this).val();
        $.post('<?php echo get_home_url(); ?>/wp-content/plugins/thermax/filter.php',
               {side_door_on_size:side_door_on_size}, 
               function(data){
                  alert(data);
              });
       })
  })

回答by Laukik Patel

please try with

请尝试

<script>
    $(document).ready(function() {
        $("[name=side_door_on_size]").click(function() {
            var side_door_on_size = $(this).val();
            $.post('<?php echo get_home_url(); ?>/wp-content/plugins/thermax/filter.php', {side_door_on_size: side_door_on_size}, function(data) {
                alert(data);
            });
        });
    });
</script>