I have the following code in my html page:
$("#rulecondition").change(function () {
var txt = $(this).val();
alert(txt);
switch (txt)
{
case 'Always use this rule':
$('#callerid_condition_container').hide();
$('#time_condition_container').hide();
break;
case 'Depends on who is calling':
$('#callerid_condition_container').fadein();
$('#time_condition_container').hide();
break;
case 'Depends on the time of day':
$('#time_condition_container').fadein();
break;
default:
}
});
When I load the page, I'm getting a script error that says:
SCRIPT5009: '​' is undefined
testpage, line 262 character 6
Here's what the rendered code looks like:
$("#rulecondition").change(function () {
var txt = $(this).val();
alert(txt);
switch (txt)
{
case 'Always use this rule':
$('#callerid_condition_container').hide();
$('#time_condition_container').hide();
break;
case 'Depends on who is calling':
$('#callerid_condition_container').fadein();
$('#time_condition_container').hide();
break;
case 'Depends on the time of day':
$('#time_condition_container').fadein();
break;
default:
}
});â
As you can see, there's some funky character after the closing bracket for my jQuery method. I'm not sure how that's created or how to get rid of it! The other question I have is why the alert statement only shows the first word in each option? So for example, if the user selects "Always use this rule", the alert will show "Always".