View Full Version : If checkbox is checked show input field

03-27-2012, 04:21 PM
I've not really an idea how to do this. I know how to do it in PHP, but I need it dynamic

<input type="checkbox" name="facebook" value="1" />
if($_POST['facebook'] == 1)
echo "<input type='text' name='facebook_url' />";

Could someone tell me how I should do this.


03-27-2012, 06:41 PM
not sure what it would look like in php, but in js you could do this:

<input type="checkbox" name="facebook" value="1" onclick="showBox(this)"/>
<input type='text' name='facebook_url' id='fb' style="display:none"/>
<script type="text/javascript">
function showBox(elem){

03-27-2012, 07:18 PM
Hmm thank you, I am not good with JS but that isn't a hard solution, I don't see why I didn't think of that. Thank you!

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum