tags:

views:

59

answers:

2

I've been playing around a bit, with jQuery, just trying to do some replacing of text fields on click of a link and hiding/showing of content items as well. It seems to be working just fine in IE, but I can't seem to get it to work in FF.

My jQuery:

$(function() {

$(".articles a").click(function() {
    articlenumber = "1"
    $(articlenumber).css("display", "none");
    articlenumber = $(this).attr("id");
    articlename = $(this).attr("name");
    articlenumber = '".' + articlenumber + '"';
    //alert(articlenumber);
    //$(articlenumber).css("display", "inline");
    $(articlenumber).attr("style", "display:inline;")
    $(".articletitle").text(articlename)
}); 

And my HTML for this(simplified):

<a id="article1" name="Article Title1" href="#">Link</a>
<a id="article2" name="Article Title2" href="#">Link</a>
<div class="articlename">Title</div>
<div class="article1" style="display:none;">Text 1</div>
<div class="article2" style="display:none;">Text 2</div>

Any suggestions as to why this isn't working in FireFox? And anything I can clean up here?

+4  A: 
David Thomas
Good advice, thank you David - I will try this now and get back to you. I appreciate the information. -Scott
No worries, 's always a pleasure =)
David Thomas
A: 

Try changing this line:

$(".articletitle").text(articlename)

To

$(".articletitle").html(articlename)

Also I'm wondering if the class descriptors (.articletitle and .articlename) are correct? .articletitle class I do not see in the HTML - only in the javascript.. unless that's somewhere else.

jeffkee