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.

<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

var person = $j("input[@name='fs']:checked").val();

To

var person =  $j("input[name='fs']:checked").val();

A small code for developers the IE8 users to be in compatible mode.

try this

<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.

Tags: , ,

bluepicaso

I wrote a total number of 18 articles on Digital Pixel Magazine.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • Tag Cloud

    action ajax chat codeigniter CSS custom Demo experience fadein fadeout Featured fonts form HTML IE8 images javascript JQuery lightbox ligntbox menu new news Php popup Portfolio problem projects red script slide slider sliding solution user wallpaper work
  • Pages