Skip to content Skip to sidebar Skip to footer

Not Changing Textbox Value From Ui

taking value in 1st textbox and want to display it in 2nd.. 1st 2nd

Solution 1:

There is no reason to pass the name, you can pass the object.

<inputtype="text" value=" "id="marks1" name="marks1" onblur="myFunction(this)" />

and the function

function myFunction( txtobj ) { 
    alert("my value : " + txtobj.value);
}

Example

Solution 2:

To this page you can find a working example http://jsfiddle.net/Akj2M/

In any case your code is good because passing the name or passing the object this is the same.

<inputtype="text"value=" "id = "marks1"name = "marks1"onblur="myFunction('marks1')"/><script>var myFunction = functionmyFunction( txtname ) {
    alert("call");
    var txtobj = document.getElementsByName(txtname);
    alert("my value : "+txtobj[0].value);
}
</script>

Post a Comment for "Not Changing Textbox Value From Ui"