Upon clicking a button, I load some extra html in my site, which I keep in a different file. After loading it, I want to make some changes in the loaded html. I currently try to do this as follows:
$.when($("#divForInsert").load("/toInsert.html")).done(function(){
$("#someInput").val("new text in it");
});
The contents of the file are as follows:
<input type='text'
size='5'
id='someInput'
name='someInput'>
I am sure that #someInput exists (checked it in toInsert.html and with inspect element in the browser) and since I load it using .done(), I suppose it's already loaded when I try to change the val of it. So why does it refuse to be changed?
All tips are welcome!
[EDIT] I incorrectly said it was a div I tried to change, but it was actually an input field. I added it to the question.
$('#someDiv').html('content')