Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

SimonKn on "JavaScript in the Widget Backend"

$
0
0

Hey,

I'm programming a little plugin with a widget. In the backend formular for this widget I have two radio buttons, which show/hide a div container, when you click on it.
On a other page of the plugin the exact same code works, but in the backend of the widget it doesn't work. Is JavaScript in den widget backend allowed?

function form($instance) {
?>
<input id="<?php echo $this->get_field_id('layout'); ?>" name="<?php echo $this->get_field_name('layout'); ?>" value="0" type="radio"<?php if($instance['layout']==0) echo ' checked="checked"'; ?> onclick="sPP_colors.style.display='none'" />
<!-- ... second radio button with display='block' instead of display='none' -->

<div id="sPP_colors" style="display:<?php echo ($instance['layout']==0) ? 'none;' : 'block;'; ?>">Stuff</div>
<?php
}

I hope you unterstand my problem and can help me.


Viewing all articles
Browse latest Browse all 8245

Trending Articles