Roland Soós
Roland Soós

Reputation: 3280

How to reach javascript object property

I have some radio buttons like to

<input type="radio" checked="checked" value="0" id="paramsmenu_images0" name="params[menu_images]">

I would like to reach this in javascript somehow like this:

console.log(document.adminForm.params[menu_images]);

Of course it doesn't work, so how can I reach it?

Upvotes: 0

Views: 195

Answers (2)

Šime Vidas
Šime Vidas

Reputation: 185873

Is this OK?

document.getElementsByName('params[menu_images]')

You can also iterate over document.adminForm.elements to find your form element...

Upvotes: 1

brad
brad

Reputation: 32335

document.getElementById('paramsmenu_images0') will give you the dom element if that's what you want.

Upvotes: 0

Related Questions