Saracoglu Saracoglu - 7 months ago 51
Javascript Question

Viewing [object HTMLInputElement] - JavaScript

I using javascript to extract the value from the SPAN element, then put it in a hidden form field, and then submit the data but why am I getting this result?

<form onsubmit="CDMFOCT()" id="CDMFOCTform">
<div class="CDMFOCT"></div>
<span class="CDMFOCT-span"></span>
<input type="hidden" name="CDMFOCTtimer" id="CDMFOCTtimer" value="not yet defined">


function CDMFOCT() {
CronSaati = $('.CDMFOCT-span').html();


Time: [object HTMLInputElement] will...


Using JavaScript & jQuery to extract the value of span:

var node = $('.CDMFOCT-span')[0].childNodes[0].nodeValue;

Edit: Or just simply:

var node = $(.CDMFOCT-span).text();

Read more about how to get text node of an element in this link

and now putting it in the hidden form field: