html - Set text to dd element in javascript -



html - Set text to dd element in javascript -

i'd set text dd element. i've tried google question, found nothing.

could please tell me, how can set(replace) text within dd tag?

i've tried:

$('#dd_di').innerhtml = my_var; $('#dd_di').innertext = my_var; $('#dd_di').innertext = "3500";

but nil changed.

console.log($('#dd_di')); [<dd id="dd_di"></dd>]

you're trying utilize dom properties on jquery object. in jquery, utilize .text() or .html() set text , raw html of element respectively.

$('#dd_di').text(my_var); $('#dd_di').html(my_var); // or if need set raw html

innerhtml , innertext can used, need access dom element:

$('#dd_di').get(0).innerhtml = my_var; // or no jquery: document.getelementbyid("dd_di").innerhtml = my_var;

javascript html

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -