jquery, javascript

how can id below logic in jquery


<html>
<body>
<object name="control"></object>
<input type="hidden" name="controlType">
</body>
</html>

if id = "1"
control = "show me html text box"
elseif = "2"
control = "show me html drop down"
end if
controlType = control
LVL 1
ITsolutionWizardAsked:
Who is Participating?
 
Rainer JeschorCommented:
Hi,
could you perhaps explain:
- Where will the ID come from? Query string or form field?
- When do you want to run the jQuery logic?

The basic code would be
$(document).ready(function() {
	var id = 1; // get the id from ???
	var control;
	switch (id) {
		case 1:
			control = "show me html text box";
			break;
		case 2:
			control = "show me html drop down";
			break;
		default:
			control = "Unkown ID";
	}
	
	$("input[name='controlType']").val(control);
});

Open in new window


HTH
Rainer
0
 
ITsolutionWizardAuthor Commented:
1. from <Form method="get">
2. when the dropdown is onchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.