I have this input line which I am trying to extract the text of the value attribute:
<input type="text" class="card-input small-font"
ng-value="paymentVia.typeDisplay" readonly="" value="Credit card">
The function getAttribute("class")
works fine and it returns card-input small-font
but the function getAttribute("value")
returns null
. I tried .value as well but this returns an empty string.
Does anyone know why this is happening?
This is my JS:
function() {
var x = document.getElementsByClassName("card-input small-font");
var payment =x[18].value;
return payment;
}
.value
property thanattribute..
– Dayledaylightfunction foo(){}
I don't see the name in your example. – Nineteen