I am trying to get a value of a select box, using onchange, but when I use this.val
<select name="type" name="auctionlength" onchange="listing_type();" id="listingtype" class="form-control">
<option><?php echo System::translate("Choose an option"); ?></option>
<option value="auction"><?php echo System::translate("Auction"); ?></option>
<option value="buy"><?php echo System::translate("Buy It Now"); ?></option>
</select>
and the following is my function:
var listing_type = function()
{
console.log(this.val);
}
I have tried the following instead:
this.val();
this.value()
this.value
$(this).val()
$(this).value()
But still not working?