0

I am appending check-boxes in a div by jQuery. Div is scroll when overflow. But I see that when checkbox names are large then div does not horizontally scroll but extra content goes to next line while vertical scroll works fine . below is some code

below is code of div creation

  <div id="legendBox" style="overflow:scroll;width:145px;height:300px;"></div>

This code is to add check boxes in DIV

if (legendChecked == "T")
                {
                    legendtest = "<input type='checkbox' class='" + legendClass + "' name='" + legendName + "' style='background-color:" + legendColor + "' value='" + legendName + "' checked onClick=legendChanged();  title='" + legendName + "' />" + legendName;
                } else
                {
                    legendtest = "<input type='checkbox' class='" + legendClass + "' name='" + legendName + "' style='background-color:" + legendColor + "' value='" + legendName + "' onClick=legendChanged();  title='" + legendName + "' />" + legendName;
                }
                $("#legendBox").append(legendtest+"</br>");

Please tell me where is mistake.

1 Answer 1

0

Or add display:inline: http://jsfiddle.net/eq3r9/

Edit: This is a better solution: http://jsfiddle.net/eq3r9/1/

Sign up to request clarification or add additional context in comments.

2 Comments

check the second fiddle by placing <br> after each check box and placing a space in lagend name, then reduce the display area such that horizontal scroll show. You will see that legend name after space goes to next line
Not sure if I totally get what you mean, but: http://jsfiddle.net/eq3r9/2/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.