EDIT I FIGURED IT OUT. I just needed to add the jquery and in Joomla you do this by going to your template/index.php and adding this line by "//Add Javascript Frameworks" JHtml::_('jquery.framework');
.
WORKING
I need some help converting this code to javascript.
Currently it's not working in my browser using jQuery. I load the AJAX library and everything but it's not working. I just added a dropdown and div's with the same ID's as the ones I'm using to make it easier.
If I preview the form which I created in the software I'm using it is working as intended with this jQuery code; however once I save the changes to the form and go to the live site it's not doing anything. (The software is RSForm Pro for Joomla.. Yes, I'm still new to this)
Any help is appreciated.
$(document).ready(function() {
$('#DeliveryPlaces').on('change', function() {
if (this.value == '1') {
$("#LocationDelivery1").show();
$("#LocationDelivery2").hide();
$("#LocationDelivery3").hide();
$("#LocationDelivery4").hide();
$("#LocationDelivery5").hide();
} else if (this.value == '2') {
$("#LocationDelivery1").show();
$("#LocationDelivery2").show();
$("#LocationDelivery3").hide();
$("#LocationDelivery4").hide();
$("#LocationDelivery5").hide();
} else if (this.value == '3') {
$("#LocationDelivery1").show();
$("#LocationDelivery2").show();
$("#LocationDelivery3").show();
$("#LocationDelivery4").hide();
$("#LocationDelivery5").hide();
} else if (this.value == '4') {
$("#LocationDelivery1").show();
$("#LocationDelivery2").show();
$("#LocationDelivery3").show();
$("#LocationDelivery4").show();
$("#LocationDelivery5").hide();
} else if (this.value == '5') {
$("#LocationDelivery1").show();
$("#LocationDelivery2").show();
$("#LocationDelivery3").show();
$("#LocationDelivery4").show();
$("#LocationDelivery5").show();
} else {
$("#LocationDelivery1").hide();
$("#LocationDelivery2").hide();
$("#LocationDelivery3").hide();
$("#LocationDelivery4").hide();
$("#LocationDelivery5").hide();
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="DeliveryPlaces">
<option value="-">-</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
<div id="LocationDelivery1">LocationDelivery1</div>
<div id="LocationDelivery2">LocationDelivery2</div>
<div id="LocationDelivery3">LocationDelivery3</div>
<div id="LocationDelivery4">LocationDelivery4</div>
<div id="LocationDelivery5">LocationDelivery5</div>
</div>