javascript - jQuery .val change doesn't change input value -
i have html input link in value.
<input type = 'text' value = 'http://www.link.com' id = 'link' />
i using jquery change value on event.
$('#link').val('new value');
the above code changes value of text box doesn't change value in code (value = 'http://www.link.com' stays unchanged). need value = '' change well.
use attr
instead.
$('#link').attr('value', 'new value');
Comments
Post a Comment