Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
変数を使用して要素をパーセンテージ幅として設定するにはどうすればよいですか?
var progBarValue = $('.days-due').text(); $('.bar').width(progBarValue%);
値は文字列なので、パーセント記号を追加するだけです。
var width = parseInt(progBarValue); if (width > 100) { width = 100; } $('.bar').width(width +"%");