Using textbox text in javascript
- by Jambo
I am working with Twitter widgets with the following script-
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="button" value="Run Function" onclick="test();" />
<script>
function test() {
new TWTR.Widget({
version: 3,
type: 'profile',
rpp: 8,
interval: 30000,
width: 315,
height: 340,
theme: {
shell: {
background: '#333333',
color: '#ffffff'
},
tweets: {
background: '#000000',
color: '#ffffff',
links: '#4aed05'
}
},
features: {
scrollbar: false,
loop: false,
live: false,
behavior: 'all'
}
}).render().setUser(document.getElementById('TextBox1').value).start();
}
When using the function test(); in the button click it is ocming up with the error -
Error: Unable to get value of the property 'value': object is null or undefined
So it seems like it is not getting to the value at -
(document.getElementById('TextBox1').value)
I am not sure why it is null if the text box has a value and then the script is run on the button click?