Saturday, 31 August 2013

input onfocus not changing div style

input onfocus not changing div style

I have two input forms. I want the second input form to appear when the
user focuses on the first input form. I used a simple javascript "onfocus"
within the input tags. This worked fine when it was changing the style of
another input form. This however left an unwanted gap. I tried making it
so the entire div group appeard onfocus but it had no effect.
I want to make the entire "form-group" div to appear when the user focuses
on the first input form but for some reason, this is not working at all.
HTML
<div class="form-group<?php if(form_error('con_password') != ''){ echo "
has-error"; } ?>">
<div class="col-md-10">
<input type="password" name="con_password" class="form-control
input-lg" placeholder="Password Confirmation"
onfocus="occupation.style.display='block'">
<span class="help-block"><?php echo form_error('con_password');
?></span>
</div>
</div>
<div class="form-group<?php if(form_error('occupation') != ''){ echo "
has-error"; } ?>" id="occupation">
<div class="col-md-10">
<input type="text" name="occupation" class="form-control input-lg"
value="<?php echo set_value('occupation'); ?>"
placeholder="Occupation" onfocus="hearus.style.display='block'">
<span class="help-block"><?php echo form_error('occupation');
?></span>
</div>
</div>
CSS
#occupation{
display: none;
}

No comments:

Post a Comment