//does not work
$("#TextBoxID1").attr("value","HI Value Change")
//work fine
$("#TextBoxID2").val("HI Value Change")
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<input type="text" id="TextBoxID1"/>
<input type="text" id="TextBoxID2"/>
I want to set value for textbox but jquery .attr()
does not work while if I try .val()
it works fine.
I am using angular-autocomplete and in its input control I want to set the value using jquery it works but I just want to know why .attr()
does not work.