I'm writing a basic app which involves changing the html in divs referenced by name, and it's working fine in Chrome, Firefox, Safari, etc. but not in our beloved Internet Explorer. I'm loading the content dynamically so I can't give you full code but here's an example of the HTML (where there would be many such divs stacked with ascending numerical names):
<div id="entry" class="entry" name="15">
<div id="comment" class="comment" name="15">Click here...</div>
<div id="rating" class="rating" name="15">24</div>
</div>
And here's the jQuery function triggered when a user clicks on the "entry" div:
$.fn.rateup = function() {
var dname = $(this).attr('name');
var rating = $("div.rating[name="+dname+"]").html();
var newrating = parseInt(rating)+1;
$("div.rating[name="+dname+"]").html(newrating);
}
Now, what I want to have happen is for the HTML in the rating div within the clicked entry div to increase by one, but in IE the rating of the entry div below the one clicked increases. I have no idea how it could possibly be selecting the wrong div here, as it has a very specific name which is very clearly referenced in my code. I've tried doing the same thing with jQuery's .find() method within the clicked entry div, and get the same result. I'm stumped.
Click here to see what I'm talking about. It may be buggy in other ways, but this is the only thing I'm concerned with at the moment. If worst comes to worst, I can just have it select element with [name=parseInt(dname)-1] if and only if rendered in IE, but I'd like to find a less hackey solution.
Thanks for your thoughts.
EDIT (6/24 11:30pm)
Incorporating the answers below and my newfound knowledge that some quirky CSS was positioning things in confusing places (inline float right pops things down to the next line unless handled correctly), I have resolved this problem. Thanks to you all for helping me become a better coder. I'll start using attributes more correctly!