jQuery, selecting form elements by name, getting: Error: uncaught exception: Syntax error, unrecogni
- by Mark Steudel
I'm trying to select an select element by name I found this thread showing how to do it, and I followed it but I'm getting Syntax error. I'm using jquery 1.4.1, here's my code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TODO supply a title</title>
<script type="text/javascript" src="/js/jquery-1.4.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert( $('select[@name="country[0]"]').val() );
})
</script>
</head>
<body>
<form>
<select name="country[0]">
<option value="23">test</option>
</select>
</form>
</body>
</html>
Thanks in advance for any insight.
MS