Grow your CSS skills. Land your dream job.

Jquery Badge

  • # April 23, 2013 at 9:31 am

    JavaScript Guru’s ! I have an issue which i feel you can help with , im working on a webpage
    http://big5auction.com/cars_suvs.html. I need to edit the text on the red badges e.g. “under offer”. When i pull the code in firefox i can see the original line of code but when i go to my editor the line of code is not visible. That means i can change the text. The js file for the badge is as follows

    function($)
    {$.fn.badger=function(badge,callback)
    {var badgerExists=this.find(‘#Badger’).html();if(!badge)
    {if(badgerExists)
    {this.find(‘#Badger’).remove();}}
    else
    {var oldBadge=this.find(‘#Badge’).text();if(badge.charAt(0)==’+’)
    {if(isNaN(badge.substr(1)))
    {badge=oldBadge+badge.substr(1);}
    else
    {badge=Math.round(Number(oldBadge)+Number(badge.substr(1)));}}
    else if(badge.charAt(0)==’-‘)
    {if(isNaN(badge.substr(1)))
    {badge=oldBadge-badge.substr(1);}
    else
    {badge=Math.round(Number(oldBadge)-Number(badge.substr(1)));}}
    if(badgerExists)
    {this.find(‘#Badge’).html(badge);}
    else
    {this.append(‘

    ‘+badge+’

    ‘);}
    if(isNaN(badge))
    {this.find(‘#Badge’).removeClass(‘badger-number’).addClass(‘badger-text’);}
    else
    {this.find(‘#Badge’).removeClass(‘badger-text’).addClass(‘badger-number’);}
    if(callback){callback(badge);}}};})(jQuery);

    What can i do to make code visible so i can make changes.

    Many Thanks

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".