I need to pass a value from a viewbag to an HTML element via javascript, and I do not know the correct syntax to do it ... Well, I could pass this value in the traditional way, but I need to set this value via javascript ... Example (this does not work):
script>
function pegavalor() {
document.getElementById('CategoriaDescricao').value = @ViewBag.CategoriaDescricao;
}
</script>