单项选择题

想要获取到img元素的src属性值,以下写法正确的是()。

A.$("img").getAttribute("src")
B.$("img").attr("src")
C.$("img").attr("src","")
D.$("img").getAttr("src")