jQuery .attr('value', 'new_value') not working?

前端 未结 11 1884
面向向阳花
面向向阳花 2020-12-10 04:56

I am trying to dynamically change the actual HTML value attribute of an input using jQuery. Although using input.attr(\'value\', \'myNewVal\'); wor

11条回答
  •  有刺的猬
    2020-12-10 05:52

    I have a case in which jQuery function .val() and .attr("value", "...") works incorrect for value with url. Functions update the user interface but it doesn't effect with DOM(source). In this case should be used:

    jQueryObj[0].setAttribute("value", "...");
    

    It's right for jQuery v1.5.* => v1.6.*, for another versions it's not be checked.

提交回复
热议问题