jQuery Selecting HTML Elements
To Read Select Option Value
$('#selectId').val();
To Set Select Option Value
$('#selectId').val('newValue');
To Read Selected Text
$('#selectId>option:selected').text();
changes the src and alt attributes for an <img> element. The code $('img') is selecting the <img> element.
<!DOCTYPE HTML>
<html>
<head>
<title>jquery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('img').attr({src: 'images/image.jpg', alt: 'image'});
});
</script>
</head>
<body>
<strong>This is image.</strong>
<img src="images/image.jpg" alt="cover1" />
</body>
</html>


