Calling Javascript Function With Button And Input From Textbox
I have a textbox and button in my page. I have several sets of the below for different purpose.
Solution 1:
<inputtype="button" value="Edit" onClick="compute(edit(document.getElementById('new').value))" />
This is how you handle it there in the HTML.
Else you can write the same code in javaScript.
functionedit()
{
x = document.getElementById('new').value;
//use this X.
}
Solution 2:
why you don't try this by Jquery it is to understand and easy to implement.
$('input[type=button]').click(function(){
alert($('#new').val());// to get input text value
$('#new').val('xxx');//to set input text value
});
your question Fiddle Here
Solution 3:
Try
<inputtype="button" value="Edit" onclick="compute(edit(document.getElementById('new').value));" />
Post a Comment for "Calling Javascript Function With Button And Input From Textbox"