简体   繁体   中英

How can I get the jQuery methos text() function to work in IE8?

I am using jQuery Library to dynamically change my page.

But I am having an issue when using text() method. I get this error only in IE8 and below.

Unexpected call to method or property access.

Here is my code

$('.survey-navigator').on('click', function(e){
    e.preventDefault();
    //console.log( $('#survey-optional-controls').val() );
    //return;
    $(this).attr('disabled','disabled');
    $(this).text('Processing...');
    if($(this).attr('id') == 'survey-previous'){
        $('#survey-nav-direction').val('previous');
    }
    $('#survey_form').submit();
});

IE 8 is complaining about the line $(this).text('Processing...');

I tried to changing the method text() to html() which gave me the same error.

Here is my HTML markup for the button

<div class="col-md-4 text-right">
<input class="btn btn-primary survey-navigator" type="submit" value="Next Page &#62;&#62;">

How can I get IE 8 to recognize that text method?

您可以尝试使用html()而不是text(),但是如果您的.survey-navigator是表单元素,则text()不起作用,则需要使用.val()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM