Reputation: 12592
I have the following code
<input id="url" type="text" value="blab.ogg"/>
<input id="fileUrl" type="file" size="1" onblur="document.getElementById('url') = this.value"/>
i need to set the same text in fileUrl
, into url
if somebody inserts a file by file chooser.
what is the event which triggers the dynamic change in text in input.
Upvotes: 0
Views: 73
Reputation: 24276
Try onchange
event:
<input id="fileUrl" type="file" size="1"
onchange="document.getElementById('url').value = this.value"/>
Also, as you can see, you should assign the file input value to the value of the url input:
document.getElementById('url').value = this.value
Upvotes: 1