Jquery Problem - Select an option then a text area appears

Hi Techies, I want to get a text area appear after I select an item from a drop down if I select yes no text area appears if I select no a text area appears asking reasons me to input (in the text area) why I said no .. I f you have a link, code or how.. am also trying the select val functions in jquery Thanks -- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

from the top of my head <script type= "text/Javascript"> $(document).ready(function() { $('#textBox').hide(); $(#dropDown).change(function() { ($'#textBox').show(); }); }); </script> <select name="dropDown" id="dropDown"> <option value="1">option 1</option> <option value="2"><option 2</option> </select> <input type = "text" name="text" id="textBox" /> On Wed, Mar 31, 2010 at 11:47 AM, Calvin Omari <calvinebarongo@gmail.com> wrote:
Hi Techies,
I want to get a text area appear after I select an item from a drop down if I select yes no text area appears if I select no a text area appears asking reasons me to input (in the text area) why I said no .. I f you have a link, code or how.. am also trying the select val functions in jquery
Thanks
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

sorry i had not read the question properly. <script type= "text/Javascript"> $(document).ready(function() { var value = $('#dropDown').val(); $('#textArea').hide(); if(value == 1) { ($'#textArea').show(); } }); </script> <select name="dropDown" id="dropDown"> <option value="1"> No</option> <option value="2">Yes</option> </select> <textarea name="text" id="textArea" /></textarea> On Wed, Mar 31, 2010 at 12:32 PM, Chris Mwirigi <mwirigic@gmail.com> wrote:
from the top of my head
On Wed, Mar 31, 2010 at 11:47 AM, Calvin Omari <calvinebarongo@gmail.com> wrote:
Hi Techies,
I want to get a text area appear after I select an item from a drop down if I select yes no text area appears if I select no a text area appears asking reasons me to input (in the text area) why I said no .. I f you have a link, code or how.. am also trying the select val functions in jquery
Thanks
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke

@Mwirigi Thanks let me give it a try, Regards On Wed, Mar 31, 2010 at 12:46 PM, Chris Mwirigi <mwirigic@gmail.com> wrote:
sorry i had not read the question properly.
<script type= "text/Javascript"> $(document).ready(function() {
var value = $('#dropDown').val(); $('#textArea').hide();
if(value == 1) { ($'#textArea').show(); }
});
</script>
<select name="dropDown" id="dropDown"> <option value="1"> No</option> <option value="2">Yes</option> </select> <textarea name="text" id="textArea" /></textarea>
On Wed, Mar 31, 2010 at 12:32 PM, Chris Mwirigi <mwirigic@gmail.com> wrote:
from the top of my head
On Wed, Mar 31, 2010 at 11:47 AM, Calvin Omari <calvinebarongo@gmail.com>
wrote:
Hi Techies,
I want to get a text area appear after I select an item from a drop down if I select yes no text area appears if I select no a text area appears asking reasons me to input (in the text area) why I said no .. I f you have a link, code or how.. am also trying the select val functions in jquery
Thanks
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us.
Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f...
------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks ------------ Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1f... ------------ Skunkworks Rules http://my.co.ke/phpbb/viewtopic.php?f=24&t=94 ------------ Other services @ http://my.co.ke
-- Our greatest fear is not that we are inadequate, but that we are powerful beyond measure. It is our light, not our darkness, that frightens us. Calvin Omari Systems Developer/Designer http://www.facebook.com/barongo

Did you try it please? it seems not to work here is waht i have used <!DOCTYPE html> <html> <head> <style> button { margin:4px; cursor:pointer; } input { margin:4px; color:blue; } </style> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <div> </div> <script type= "text/Javascript"> $(document).ready(function() { var value = $('#dropDown').val(); $('#textArea').hide(); if(value == 1) { ($'#textArea').show(); } }); </script> <select name="dropDown" id="dropDown"> <option value="1"> No</option> <option value="2">Yes</option> </select> <textarea name="text" id="textArea" /></textarea> </body> </html>

This seems working <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Show/Hide</title> <script type="text/javascript"> // <![CDATA[ function display(obj,id1,id2) { txt = obj.options[obj.selectedIndex].value; document.getElementById(id1).style.display = 'none'; document.getElementById(id2).style.display = 'none'; if ( txt.match(id1) ) { document.getElementById(id1).style.display = 'block'; } if ( txt.match(id2) ) { document.getElementById(id2).style.display = 'block'; } } // ]]> </script> </head> <body> <table width="340" cellspacing="0" cellpadding="2"> <thead> <tr> <td class="title">Type:</td> <td class="field"> <select name="type" onchange="display(this,'text','image');"> <option>Please select:</option> <option value="image">Image</option> <option value="text">Texts</option> <option value="invisible">Invisible</option> </select> </td> </tr> </thead> <tfoot> <tr> <td class="align-center" colspan="2"><input type="submit" name="submit" value="Update" /> <input type="reset" value="Reset" /></td> </tr> </tfoot> <tbody id="text" style="display: none;"> <tr> <td class="title">Text Color:</td> <td class="field"><input type="text" name="color" size="8" maxlength="7" /></td> </tr> </tbody> <tbody id="image" style="display: none;"> <tr> <td class="title">Image:</td> <td class="field"><input type="file" name="image" size="10" /></td> </tr> <tr> <td class="title">X Coordinates:</td> <td class="field"><input type="text" name="x_coordinates" size="5" /></td> </tr> <tr> <td class="title">Y Coordinates:</td> <td class="field"><input type="text" name="y_coordinates" size="5" /></td> </tr> <tr> <td class="title">Text Color:</td> <td class="field"><input type="text" name="color" size="8" maxlength="7" /></td> </tr> </tbody> <tbody> <tr> <td class="title">Display:</td> <td class="field"> <select name="display"> <option value="visitors">Visitors</option> <option value="hits">Hits</option> </select> </td> </tr> </tbody> </table> </body> </html>
participants (2)
-
Calvin Omari
-
Chris Mwirigi