类型错误:升压叫不实现接口的对象上HTMLInputElement [英] TypeError: stepUp called on an object that does not implement interface HTMLInputElement

查看:217
本文介绍了类型错误:升压叫不实现接口的对象上HTMLInputElement的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个code

<a data-remote="true" data-box_no="1" class="find_or_add_horse" href="#">Find/Add Horse</a>

和我做的Ajax调用,当我点击其中一个链接

And I do ajax call when I click one the link

$(document).on('click', '.find_or_add_horse', function () {
        var search_term = $(this).parents('.sub-middle-column').find('.search_horse');
        var box_no = $(this).data('box_no');


        $.ajax({
            url: "/startup_wizard/find_horse",
            dataType: 'script',
            type: 'GET',
            data: { box_no: box_no, search_term: search_term}
        });
        return false;


    });

但是,当我点击我得到这个错误链接类型错误:升压叫那些没有实现的对象接口HTMLInputElement 当我删除此$ C从Ajax调用$ C

But when I click on the link I get this error "TypeError: 'stepUp' called on an object that does not implement interface HTMLInputElement" when I remove this code from ajax call

data: { box_no: box_no, search_term: search_term}

我的code只是正常工作。为什么发生这种情况,如何解决这一问题?我怎样才能发送数据?

my code just work fine. Why this is happening and how to fix this? How can I send the data?

推荐答案

如果 SEARCH_TERM 是您可能希望RO得到其数值输入栏。

If search_term is an input field you might want ro get its value.

var search_term = $(this).parents('.sub-middle-column').find('.search_horse').val();

现在你所引用包含HTMLDom-元素一个jQuery对象,但我想你想要什么是搜索输入元素中的字符串。

Right now you are referencing a jQuery Object containing a HTMLDom-Element but I think what you want is the string inside the search input element.

这篇关于类型错误:升压叫不实现接口的对象上HTMLInputElement的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆