首页javascriptclassjQuery Selector - 如何按类别选择

jQuery Selector - 如何按类别选择

我们想知道如何按类别选择。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-2.0.0.js'></script>
<style type='text/css'>
.activeMenu {
  color: Red;
}
</style>
<script type='text/javascript'>
$(window).load(function(){
    var a = $('[id*="firstName"]')
    console.log(a.get());
    a.css( "background-color", "yellow" );
});
</script>
</head>
<body>
  <span id="span.firstName">asdf</span>
  <input id="input.firstName" value="asdf" />
</body>
</html>