Xui js input value

488 views Asked by At

i'm using xui.js (v 2.3.2) and try to return the value of an input text field.

x$('#field-email').value -> return undefined
x$('#field-email').attr('value') -> return ['[email protected]'] including bracket and quote.

What I don't understand is why the first sample return undefined.

Thanks

2

There are 2 answers

0
Paul On

x$('#field-email') don't returns DOMElement, it returns the xui object with elements selected by css selector. You can access input value this way: x$('#field-email')[0].value.

0
KamaSeki On

Paul“s right. if you get an Element by x$('#field-email')[0] ,you can use simple JS functions like x$('#field-email')[0].tagName. THis would return the Tag name..