Return to Snippet

Revision: 8634
at October 1, 2008 09:48 by 1man


Initial Code
//Clear the value in the text form when you click other
	$("#other").click(function(){
		$("#inputAmount").attr("value", "").focus().select();
	});
	
	$("#donateBox form").submit(function(){
		//Check to see if the radio button is checked
		if($("#other").is(":checked")){
			//Take value from the text box
			var ourValue = $("#inputAmount").attr("value");
			//Check to see if we have a value
			if(ourValue ==="" || ourValue ==="0"){
				ourValue = "5";
			}
			//Add it to the radio button
			$("#other").attr("value", ourValue);
		} else {
			return;
		}
	});

Initial URL

                                

Initial Description
This snippet is useful on donate forms. If you have a radio button for other value, then this will clear the current value in the text input box, and attach the user in putted value to the other radio button.

Initial Title
jQuery radio button donate submit

Initial Tags

                                

Initial Language
JavaScript