Bill.Caffery
Bill.Caffery

Reputation: 464

javascript not working in IE with radio button onClick

I have some code which acts as a redirect and sets some values when a user clicks on a radio button. In chrome and firefox these scripts work perfectly however in IE nothing seems to happen at all.

HTML

<td>
    <input type='radio' id="order_type6" name='order_type' value="5"
        onClick="selectOrderType('1')">
    <label for="order_type6"><strong>Facility Employee</strong></label>
</td>
<td>
    <input type='radio' id="order_type7" name='order_type' value="5" 
        onClick="selectOrderType('1')">
    <label for="order_type7"><strong>Private Contract</strong></label>
</td>

JS function:

function selectOrderType(type)
{
    console.log(type);
   //replace '&load=1' with '&neworder=1'
    $location = window.location.href.replace(/&load\=1/,'&neworder=1#');
   //replace '#' at the end of the string with '' + $ordertype
    window.location.href = $location.replace(/#?$|&order_type\=\D?/,'&order_type='+type);
}

Upvotes: 0

Views: 963

Answers (1)

mplungjan
mplungjan

Reputation: 178126

Remove the console.log - or press F12 to open the console.

IE does not support console if it is not open

'console' is undefined error for Internet Explorer

Or change to window.console && console.log(type)

Upvotes: 2

Related Questions