|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Adding data depending on checkbox checked or not
Hi there - i have been using the following to add two fields together into one textbox:
PHP Code:
I was wondering, is it possible to implement checkboxes aswell so that if i checked a checkbox called checkbox1 for example, with the value "running" then the value "running" would be added to the textbox where everything gets added to - if the checkbox was unchecked then "running" would be removed again?! Is this possible? If so, how do i go about doing this? Thanks |
|
#2
|
||||
|
||||
|
the best way is to have a sepreate function to add on the running or to not add running
for example _inverseit=false; //_inverseit=true; function yesorno() { if (_inverseit) {return "not ";} else {return "";} } var string="your favorite food is "+yesorno()+"steak"; if _inverseit is set to be true, it will the string will look like this... your favorite food is not steak otherwize like this your favorite food is steak do you see where im going? have a function to return text if a checkbox is checked hope this help colton22 |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Adding data depending on checkbox checked or not |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|