how do i set the text that my json file is printing to screen i want to hide the text


Tags: jquery,css,json

Problem :

i have a json data file that stores values and prints it out to the screen but the problem is that the values is attached to a css property width. i dont want the output to be the actual data in the form of a number, i just want to connect the json file and have the value set the width of where the bar must be.

my jquery is:

        $(document).ready( function(){
        var MAX_WIDTH = 100; // Define max bar width in Pixels here
        $.getJSON( "js/json/sidekicks.json", function(obj){
            $.each(obj.Sidekicks, function(key, value){
                var color = 'rgb(' + ((value.Score / 100) * 255) + ', #de0001, 10';
                var width = (value.Score / 33) * MAX_WIDTH;
                $('div#' + value.Id).find('span.red_line_fill').text(value.Score).css("background-color", color).width(width);

            });

        });

    });

here is a picture to show what i mean. i want to remove the value 20 that prints out to the screen enter image description here

how would i get who ever is in the lead to display the image "1st"

enter image description here



Solution :

use text('')(or remove .text() to not set any value. But this will not hide already shown text) to set empty value.Try this:

  $('div#' + value.Id).find('span.red_line_fill').text('').css("background-color", color).width(width);

    CSS Howto..

    CSS/PHP: How to make the next div appear on the side instead

    how to change li last anchor color

    How not to mess up styling when using css frameworks

    CSS - How can I set the content to attr() but when attribute isn't available, set it to 0 or another?

    How to right align last two columns of a table with CSS

    how to make the images always in center

    How to control the HTML area to the right?

    How I can get an Image height and divide it by 2 using Jquery

    How to make a scrollable div inside of a div with a specific height

    How to inject css in another page

    How to use a divider in a navigation with list elements?

    How to render text in .NET in the same size as browsers does given CSS for the text

    Is there a limit to how deep an HTML document or CSS tree can be?

    How to debug HTML/CSS for iPhone/iPad performance?

    links are showing up on each line, instead of inline

    How to reference all the rows except the first one using css

    How to display line items in twos?

    How to convert from Powerpoint to HTML / CSS ? (FOSS)

    How to switch between custom css layout and bootstrap css layout

    how to avoid firefox to add overlay color on image click?

    How to make elements appear under a
      in Firefox & IE8?

    How can I set css for a class in a class?

    How to figure out which lines of css is not actually affecting anything again?

    How to use SVG fragment identifier for CSS background image on iOS?

    How to vertically center content in before or after in CSS

    CSS show elements below each other

    How do you solve this problem regarding aligning divs next to each other? [duplicate]

    how to fire a jquery child function at the start of parent animation

    Always show hover text in an appropriate position

    How can i get spaces between images with the same class?