Q:

 How to use ELSE IF in using radio box

I have a radio box.
<td>
    <label for="requireDate"><input type="radio" id="date" value="requireDate" name="date" checked="checked"/>START DATE</label>
    <label for="finishDate"><input type="radio" id="date" value="finishDate" name="date" />END DATE</label>
</td>

Based on this value, two different Ajax function will be called when clicked on SEARCH button.
<script type="text/javascript">
$('#search').click(function() {         

if($('#date').val() == 'requireDate'){
    CommonUtil.ajaxPagingSubmit('<c:url value="${innovativepot}/A/SubscDtm" />', 1, $('#frm').serialize(), 'content');      
} else if ($('#date').val() == 'finishDate') {
    CommonUtil.ajaxPagingSubmit('<c:url value="${innovativepot}/A/cpltSubscDt" />', 1, ('#frm').serialize(), 'content');                
    }           
});
</script>

But for some reason, it calls up the first function for either one. 
Can someone tell me where is wrong with that?

A:

Both have the same id. Select by name.
Change to:
if($(':radio[name=date]:checked').val() == 'requireDate'){ ...

Cheers

