Message from JavaScript discussions

July 2017

— Or a function that calls it

— 

Wew, this all make me confused,
well, last question, hope you doesnt bothered and can help me TRGWII
i have change the code to this :

listItem.click(
function bukapaket() {
document.querySelector('#coreNavigator').pushPage('harga.html');
event.target.querySelector('ons-toolbar .center').innerHTML = el.nama;
console.log("ID dari halaman ini adalah "+el.id+" , dan Nama dari halaman ini adalah "+el.nama+" , dan ini adalah Halaman Harga");
});
$('#datalist').append(listItem);


why that .innerHTML resulted as null but that el.nama appear in console.log ?

— Uhhh, why use event.target?

— And please don't use innerHTML

— Use .textContent

— Erm, event.target is from a mobile framework that i used i think 😅 i doesn't know if that event.target is from native js or customized one.

Message permanent page

— Wait, gonna try that textcontext

— Textcontent*

— Replace event.target with document ?

— Uncaught TypeError: Cannot set property 'textContent' of null 🤔
replace event.target with document.getElementByClassName?

Message permanent page

— document.querySelector('ons-toolbar.center').textContent = el.nama;

— Well, no error, but the object isnt change.