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

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -