jquery selector for dropdown list

jquery selector for dropdown list

Dear Sir:

if i choose "XHTML",the b will print "unDefined" ,and a will print "0" ?  why b does not print the value "0"? is that selector index different from javascript? please for helping, thank

function test(obj)
{
    var a=document.getElementsByName('multipleselect')[0].selectedIndex;
    var b=$("#multipleselect").attr("selectedIndex");
    alert(a+","+b);
}




<body>
<select  id="multipleselect" name="multipleselect" onChange="test()">
   <option>XHTML</option>
   <option>CSS</option>
   <option>JAVASCRIPT</option>
   <option>XML</option>
   <option>PHP</option>
   <option>C#</option>
   <option>JAVA</option>
   <option>C++</option>
   <option>PERL</option>
  </select>










</body>