jquery - Set width no higher than 100% -



jquery - Set width no higher than 100% -

how set width never goes higher 100% based on variable value?

var progbarvalue = $(this).find('.days-due').text(); $(this).find('.bar').width(progbarvalue +"%");

i need width value clamp maximum of 100%.

for example: if progbarvalue returns 250% width still 100%.

i think have modify variable since width attribute can >100%.

var progbarvalue = $(this).find('.days-due').text(); progbarvalue = progbarvalue > 100 ? 100 : progbarvalue; $(this).find('.bar').width(progbarvalue +"%");

jquery

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -