I want to change the value of a text input with jQuery when a certain function passes. I used this code:
$('#find').attr("value", "newvalue");
But it’s not changing it. This is the markup of the input I want to change:
<input type="text" id="find" class="input" />
I know it’s getting to this peice of code because the jQuery either side of it executes and works.
Any help would be appreciated, thanks.
Not sure why yours doesn’t work though.
You might also need a name attribute on the input? Not sure if that matters…
It could also be running before the input is created. In which case wrap it in
Or just stick the script block after the element in your source (this might be a controversial suggestion).