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');

demo


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -