The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> dependent drop downs, populating select lists with .txt files
dod0bird
post Feb 6 2016, 01:32 PM
Post #1





Group: Members
Posts: 1
Joined: 6-February 16
Member No.: 23,964



im trying to make these select lists work and for some reason its not enabling my dependent list and pulling my data from the .txt files... well it may be pulling data, not sure... but its definitely not working. I have request.txt, schedule.txt, product.txt, and other.txt in a folder named data next to my html file.

can anyone see where I went wrong?

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Contact form</title>
<link href="../css/multiColumnTemplate_form.css" rel="stylesheet" type="text/css">
</head>
<body>
<div class="container">
<header>
<div class="primary_header">
<h1 class="title">&nbsp;</h1>
<form name="form1" method="post" action="" class="title">
<p>Name:
<input type="text" name="name" id="Name" size="30">
</p>
<p>Email:
<input type="email" name="email" id="Email" size="30">
</p>
<p>Phone No:
<input type="tel" name="Telephone" id="Telephone" size="12"></p>
<p><select name="request" id="request">
<option value="0" selected>---Choose one---</option>
<option value="request">Request Quote</option>
<option value="schedule">Schedule Service</option>
<option value="product">Request Product Information</option>
<option value="other">Other</option>
</select>
</p>
<select name="regarding" disabled id="regarding">
<option value="0">---Choose one---</option>
</select>

</form>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js">
<script>
$ (function() {
var regarding = $ ('#regarding');

$ ('$request') .change (function(e) {
var sel - $(this).val();
regarding.html ('');
if (sel !='0') {
$.get('data/' + sel + '.txt' ,function(response) {
regarding.html (response);
regarding.removeAttr('disabled');
$('option[value="0"]', e.target).remove();
}),
}
});

regarding.change(function(e) {
if $(this).val() !='0') {
$('option[value="0"]',e.target).remove();
}
});
});
</script>

<p></p>

</div>

</header>
</div></body>
</html>

This post has been edited by dod0bird: Feb 6 2016, 01:35 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 26th April 2024 - 03:52 PM