Welcome Guest, Not a member yet? Register   Sign In
[solved] Jquery + form Helper - Newbie question

[eluser]Juan Velandia[/eluser]
Hello Everyone, I'm starting with Jquery and I'm trying to hide a div when a user checks a radio button, and as this is my first jquery code within Codeigniter I'm having some issues:

this is in the view
<div class="div_to_hide">
This must be hidden!

this is the javascript in &lt;head&gt;
$(document).ready(function() {
         alert("HELLO this works!");

And heres the radio button with the form helper format
&lt;? $js1 = 'onClick="$('div.hide').hide();"'; ?&gt;
Persona:&lt;?php echo form_radio('#person', 'Natural', TRUE, $js1 ); ?&gt;

Any Ideas?. Thanks a lot, Any suggestion will be highly appreciatted.

[eluser]Juan Velandia[/eluser]
I've made it work!:

The JS code:


the HTML:
&lt;?$js1 = 'id="radio_button1"'; ?&gt;
Soy persona Natural&nbsp;&lt;?php echo form_radio('tipo_persona', 'Natural', TRUE, $js1); ?&gt;

&lt;?$js2 = 'id="radio_button2"'; ?&gt;
Soy persona Juridica&nbsp;&lt;?php echo form_radio('tipo_persona', 'Juridica', FALSE, $js2); ?&gt;

<div class="hide">
This shows/hides when radiobutton is clicked

Theme © iAndrew 2016 - Forum software by © MyBB