javascript - Calculate width for each list item with jquery -


i need new jquery function line of css now:

#progressbar li {width: calc(100% / 5); /* divide number of steps */} 

this jquery code created not work:

var count = $("#progressbar").children().length result = parseint(100) / parseint(count); $( "#progressbar > li" ).css( "width", "result%" ); 

this set width of multi-page form progress bars forms of varying lengths , steps. thanks!

edit:

thanks all. working now, if have better way let me know. creating several new forms online. have first 2 linked here:

http://new-site.autouplinktech.com/forms/form-video360.html http://new-site.autouplinktech.com/forms/form-inteliphoto.html

i running lot of issues implementing jquery validation on forms since uses multi-step show each fieldset separately, can topic of post here.

$( "#progressbar > li" ).css( "width", "result%" );

should be:

$( "#progressbar > li" ).css( "width", result + "%" ); 

also, add semi-colon first statement:

var count = $("#progressbar").children().length; 

[this isn't source of problem of course though :)].


Comments

Popular posts from this blog

android - Automated my builds -

how to proxy from https to http with lighttpd -

python - Flask migration error -