JQuery :: Show / Hide A <div> When Changing The Selection Of A Radio Button?
Mar 2, 2010
I want that a <div> element will show when yes is selected and when no it should be hidden. For show and hind i will use the functions from the jQuery UI. But I don't find a way to call the hide / show function when the selection change.
The radio selection: <input type="radio" name="lang_anz" value="1"> Yes<br> <input type="radio" name="lang_anz" value="0" checked="checked"> No<br> When I understand the documentation I can request the current value from the radio with: <script type="javascript"> $('input:radio[name=lang_anz]:checked').val(); </script>But how i can now call the show / hide function when I change the selection?
View 1 Replies
ADVERTISEMENT
May 29, 2005
How to show and hide form fields depending on a selected radio button.
View 14 Replies
View Related
Mar 16, 2010
I am a PHP programmer and new to Javascript and jQuery and I have tried about 20 examples/tutorials and cannot seem to get even close to what I want.I have a form (PHP/MySQL) with a list of subjects I got from my database, and then create a set of radio buttons from that list. And based on what radio button they select, I need to pass that variable to a div (at least that's what I want to use) and then show a list of videos that match the radio buttons value. I don't care if its a get or post or other.I tried to use GET or POST so I can use that value for my PHP/MySQL lists.I am open to any suggestions/tutorials, etc.
View 1 Replies
View Related
Aug 15, 2011
I have a calculator that I want users to be able to select a radio option that will display the coresponding calculator and hide it when the other radio button is selected in other words I want to only have one visible div at a time. How would I do this?
Here is my Javascript:
HTML Code:
<html>
<head>
<script type="text/javascript">
[Code]....
View 2 Replies
View Related
Jul 20, 2005
I have a form with three radio options. And I have three buttons:
<input type="submit" name="mainform_action" value="Edit Data">
<input type="submit" name="mainform_action" value="View Data">
<input type="submit" name="mainform_action" value="Delete Data">
If the first radio button is selected, I only want all three buttons to be
visible to the user.
If the second radio button is selected, I only want the "Edit Data" and "View
Data" buttons to be visible.
If the third radio button is selected, I only want the "View Data" button to be
visible.
Is it possible to accomplish this in Javascript? In particular, I want to
continue using the "input type=submit" buttons without having to create my own.
View 3 Replies
View Related
Apr 27, 2010
I have 3 divs that contain radio with labels and beneath each radio button I would like to show/hide a form based on whether the radio is selected or not.
Code idea:
So if the radio1 input is selected this would show form1. Selecting radio2 input would hide any other forms (form1, form3) and show form 2 etc.
View 1 Replies
View Related
Mar 15, 2010
I have a form with a list of subjects (radio buttons) that I get from my database with PHP, and I want to show a list of videos (also from my video table using PHP), based on which subject they choose.
I have tried multiple POST, GET methods with JavaScript examples, but cannot get it to work. I am not having any issues with the PHP getting either list, it is just getting the radio buttons to pass either the POST or GET data to JavaScript, and have it take that value so I can get the list from my database with PHP. I tried to use a div for the list of videos, and didn't have much success.
View 6 Replies
View Related
Aug 4, 2009
I'm trying to do a show/hide on a radio button click and I do have it working, but I'd like to make it more...extensible/independent of hard- coding children elements to show hide.
My dummy html structure is:
I left some commented out stuff at the top of the function, hopefully to give you an idea of what I tried.
In particular:
I was trying to get the first ul (the children to show/hide) on "this" (the radio button clicked). I'd like this to be flexible to where you could add more radio button/children and as long as the structure stays the same, the show/hide functionality works.
View 2 Replies
View Related
Sep 14, 2009
I am trying to create a script that will display content based on if aradio button is selected, and if the other is selected would hide thecontent. Now, each of these radio buttons are part of a radio group,so their names are the same. Most examples show nput:radio[@name=item] Since I have 2 items that have the same name, I can't usename, so I thought I would try id or value. It isn't working. If I addonly the show, whenever you select either radio button, it shows, andif I add the hide code, it doesn't work at allHere is what I have right now.
$(document).ready(function(){
$('#offices_checkboxes').hide();
$("input:radio[@value=1]").click(function() {
[code]....
View 2 Replies
View Related
Mar 14, 2010
I have a page I am working and I am having some trouble with: I need to show and hide areas based on a radio selection. I initally started using the show / hide feature in Jquery but the problem is the elements need to be removed but then put back if the user selects the radio buttonagain as it has form elements that have validaion on them. The validation is still trying to validate the form elements becuase they are still on the page but just not showing. This is the radio group the user makes the selection from:
<input name="terms_usr" type="radio" id="terms_usr_1" value="1"/>
<label for="terms_usr_1">Credit Card</label>
<input type="radio" name="terms_usr" id="terms_usr_2" value="2"/>
<label for="terms_usr_2">C.O.D</label>
[Code]....
View 3 Replies
View Related
Mar 17, 2011
I have a set of radio buttons on my pricing page:
And a corresponding text_field input element div I'd like to display based on which radio button the user selects:
When the page loads, I'd like to see:
When the user clicks on a (different) radio button, or clicks one for the first time, I'd like whichever div is currently showing to be hidden, and the newly selected one to be shown.
Right now I have jQuery code at the bottom of my page that looks like this:
For each of the four options.
When the page loads, the correct div is shown, and when I select a new button, the new div is shown, but the already showing one isn't hidden.
I've read some posts that suggest using change() instead of click(), but others indicate that's problematic in IE.
View 1 Replies
View Related
Sep 17, 2010
I have to 2 radio buttons and two hidden divs. How would I be able to show and hide them depending on the selection I've chosen?
View 4 Replies
View Related
Apr 2, 2009
i have made this request as simple as possible.When my page loads I would like div1 and div2 to both be hidden
If user clicks Div 1 radio then
div1 = visible
div2 = hidden
[code].....
View 3 Replies
View Related
Jul 12, 2007
i would like to have 2 radio buttons each with a associated div when the page loads the first radio button will be checked and its corresponding div will be show when the user checks the other radio button its corresponding div is shown and the first div is hidden:
View 2 Replies
View Related
Aug 16, 2010
I am trying to develop an exam system.Find my code below.I request you to copy the code and save it as an html file .I have 2 problems:
1. Kindly notice that when the quiz is loaded,it shows both the questions by default.I want only question 1 to be visible when the quiz loads.What happens presently is that ,both questions are visible even after I click on the link
Q.1( referring to question 1).However,when I click on
Q. 2,then only question 2 can be seen and then(after clicking on Q.2) if I click on Q.1,then only question 1 can be seen
What I want is that when the page loads only question 1 is visible.Then when I click on Q.2,I can see only question 2 and when I click on Q.1, I can see only question 1.I later plan on adding many questions,so it should be a general solution rather than a solution good only for 2 questions.
2.Also,what I want is that,if someone selects any of the answers of a particular question,it's link color should turn green to indicate to the user that he answered that question.So for,instance,if I select an answer to the first question(select one of London,New York,Seattle,Washington,Chicago), the link Q.1 should turn green.
View 3 Replies
View Related
Sep 12, 2011
I am trying to hide/show table when hide/show button is pressed
Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.
Code:
View 1 Replies
View Related
Jan 10, 2011
I have the following code that generates two dropdown boxes in a form, but I would like for the second to be hidden unless the first has 'Software problem' selected. Is it possible to do this?
<p id="parent-menu">
<select name='helpdesk-category' id='helpdesk-category' class='dropdown' tabindex="40">
<option value='-1'>Select a Category</option>
<option class="level-0" value="13">Software problem</option>
<option class="level-0" value="14">Hardware problem</option>
<option class="level-0" value="15">Suggestion</option>
<option class="level-0" value="16">General query</option>
</select>
</p>
<p id="toggle-menu">
<select name='software-category' id='software-category' class='dropdown' tabindex="50">
<option value='-1'>Select a Program</option>
<option class="level-0" value="6">BigHand</option>
<option class="level-0" value="7">IRIS</option>
<option class="level-0" value="8">MS Outlook</option>
<option class="level-0" value="9">MS Word</option>
<option class="level-0" value="10">MS Excel</option>
<option class="level-0" value="11">Oyez</option>
<option class="level-0" value="12">Internet Explorer</option>
</select>
</p>
View 2 Replies
View Related
Nov 17, 2011
I got a selection tag which pulls values from DB to populate,i want to hide or show related div/table based on the selection. now i got two confusions. how can i know what is selected coz the option tag value is coming from DB, also i never work with show/hide thingy. how can i achieve it?
View 6 Replies
View Related
Apr 18, 2010
what i have are 3 radio buttons at top of my form, the first radio option i would like if selected to open a div that contains new questions on the form... then if the other radio buttons are selected they hide that div.
View 1 Replies
View Related
Jun 27, 2010
I am trying to get a css-styled button to stay on its 'roll-over' state once it has been selected by its corresponding radio button (connected via the label tag). So far, I have no idea what I'm doing.
Here's what I have so far: [URL]
This is what it's doing: [URL]
This is what I'd like it to do: [URL]
Any experts out there that can lend a hand ?
View 3 Replies
View Related
Jul 5, 2005
I have 2 radio button first is a and second is b.
If a is selected then the form action should be a.php or b is selected then b.php.
Any idea how to do this. I don't want to this in server side script.
View 3 Replies
View Related
May 23, 2010
I load a page with two default images and two radio buttons not selected. When either of the radio buttons gets checked I need to swap corresponding image. I tried this but it does not seem to work:
PHP Code:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">
function swapImage(currencyflag) {
switch (aspectflag) {
case "3x2":
3:2.src = "/i/misc/aspect3x2_rd.png";
16:9.src = "/i/misc/aspect16:9_gr.png";
case "16:9":
3:2.src = "/i/misc/aspect3x2_gr.png";
16:9.src = "/i/misc/aspect16:9_rd.png";
}}
</script>
</head>
<body>
<img src="/i/aspect3x2_gr.png" width="150" height="100" alt="" name="2x3">
<img src="/i/aspect16x9_gr.png" width="178" height="100" alt="" name="16x9">
<form>
<input type="Radio" name="aspect" id="3x2" onclick="swapImage(3x2)">
<input type="Radio" name="aspect" id="16x9" onclick="swapImage(16x9)">
</form>
</body>
</html>
View 2 Replies
View Related
Jul 9, 2009
I can't figure out why it dosen't work. I'd like to show/hide a <p> block depending on the value selected in the dropdown list:
$(document).ready(function(){
$('#report_rep_type').change(function(){
$('#report_rep_type').change(function(){
if($(this).text()!= 'Contigency Liabilities/Others')
$('#someElement').hide();
else
$('#someElement').show();
});
});
});
HTML code:
<form action="my action>
<fieldset>
<legend>Report details</legend>
<p>
<label for="report_rep_type">Report type</label><br />
<select id="report_rep_type" name="report[rep_type]"><option value="">Please select</option>
<option value="Scientific & Technical">Scientific & Technical</option>
<option value="Financial">Financial</option> .....
<p>
<button class="button " type="submit"><img alt="Tick" src="/images/silk/icons/tick.png?1245400388" /> Create</button>
</p>
</form>
View 7 Replies
View Related
Sep 2, 2011
My form has some input like this:<input type="radio" value="email@addr.es" id="edit-submitted-1">I want to hide the attribute value, not eliminate, or change... Is this ossible?I can get the value of this attribute using
: find('#
edit-submitted-1').attr('value');
and modify using:
[code]....
View 5 Replies
View Related
Aug 24, 2010
how to get contents into a textarea based on a radio button selection.
Code:
<script>
text = new Array()
text[0] = Array('Saab','Volvo','BMW');
text[1] = 'second list';
[Code]....
View 3 Replies
View Related
Jan 26, 2009
I got a table.Each row has a list of statuses.If status == yes, then several elements will be shown in the rowif status != yes, then hide those elements.Im not sure if I have made a good solution, but it seem to work ok (opera9.6, ff2, ie7)The status selector passes on a unique rowid, and itself. This way the js function can get the row, and the status of the selection. Then toggle various elements in that row.Only annoying thing is the way row elements are named and found. It kinda have to rely on some hard coding, but its ok I guess.Im not sure if its possibel to just call toggle( this ), and that way get to the elements in the row.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
[code].....
View 7 Replies
View Related