Axmed nuur Axmed nuur - 3 years ago 226
CSS Question

i can't change the border style of a div using select

I made a dropdown which is supposed to change the border style of div. I'm using select and option html tags. When the .change() event is executed, I was expecting to get the border style changed to the current select value. Please tell correct me. Here is a JSFiddle link.

Here is the js code

$(function() {
$("select").change(function() {
var getChoice = $("select option:selected").val();
$('.active').css('borderStyle', getChoice);

Answer Source

Just change val() to text()


$("select option:selected").val();


$("select option:selected").text();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download