object doesn't support this property or method document.querySelector

AndReWWi

New Member
I'm testing one line code on IE7 but it's giving me the following error: \[quote\] Object doesn't support this property or method and it refers to\[/quote\]Here's the problem line in question:\[code\]var checked = document.querySelector('[name="answer1"]:checked');\[/code\]This is the whole codeQuestion1 : did you like the training?\[code\]<input name="q4" value="http://stackoverflow.com/questions/15601447/Yes" type="radio"> Yes<input name="q4" value="http://stackoverflow.com/questions/15601447/No" type="radio"> No<br><button id="getval">cick here</button><script type="text/javascript"> document.getElementById('getval').onclick = function() { var checked = document.querySelector('[name="q4"]:checked'); alert(checked ? checked.value : 'Not selected');}</script>\[/code\]Is there anyway to fix that?
 
Back
Top