javascript - document.getElementById(fieldName).value; is not working in chrome and firefox -


following javascript in html working in ie browser. but, when execute in chrome , firefox browser not working.

var lastname = getvalueoffield("txtname");  function getvalueoffield(fieldname)     {         return document.getelementbyid(fieldname).value;     } 

please me.

it working fine...

fiddle

<input type="text" id="txtname" value="testdata">  var lastname = getvalueoffield("txtname"); function getvalueoffield(fieldname)     {     console.log(document.getelementbyid(fieldname).value)         return document.getelementbyid(fieldname).value;     } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -