tags:

views:

58

answers:

1

Basic jquery question. I have an option element as below.

<option class='select_continent' value='7'>Antarctica</option>

jquery

$(".select_continent").click(function () {
  alert(this.attr('value'));
});

This gives an error saying this.attr is not a function so im not using "this" correctly.

How can i get it to alert 7?

+4  A: 

You need to do:

alert($(this).attr('value'));
clownbaby
or `$(this).val()`
fudgey