Jquery: Tips ‘n’ Tricks
Jquery and browser support. well both of them nearly don’t work all together. I just got stuck somewhere i found a weird solution Just remove an @ symbol did that.
While working on a project i was stuck on a jquery code that wasn’t working on IE8(now free for Xp users).
I was working with two set if radio buttons. the problem was with the second radio button set.
The code that did not work was this below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
<tr>
<td>
Have you used any other names in the past eight years?
</td>
<td>
<input type="radio" name="ot" value="1">yes <input type="radio" name="ot" value="2">No
</td>
<script type="text/javascript">
$j('[name=ot]').click(function()
{
var ot = $j("input[@name='ot']:checked").val();
if(ot == 1)
{
$j("#odrnames").fadeIn("slow");
}
else
{
$j("#odrnames").fadeOut("slow");
}
});
</script>
</td>
</tr>
<tr id="odrnames" style="display: none;">
<td>
Other Names
</td>
<td>
<input type="text" id="txt" name="otherNam"> *Seperate By commas
</td>
</tr>
<tr>
<td>
Filing Status:
</td>
<td>
<input type="radio" name="fs" value="1">Single <input type="radio" name="fs" value="2">Joint
</td>
<script type="text/javascript">
$j('[name=fs]').click(function()
{
var person = $j("input[@name='fs']:checked").val();
//alert(person);
if(person == 2)
{
$j("#joint0").fadeIn("slow");
}
else
{
$j("#joint0").fadeOut("slow");
}
});
</script>
</tr>
<div>
<tr id="joint0" style="display: none;">
<td>
Full Name of Spouse:
</td>
<td>
<input type="text" id="txt" name="sname">
</td>
</tr>
I just changes the jquery codes from
1
var person = $j("input[@name='fs']:checked").val();
To
1
var person = $j("input[name='fs']:checked").val();
A small code for developers the IE8 users to be in compatible mode.
try this
1
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
So this was the solution i found. Please do comment if you have better ideas or face any problem.
