Solved

jquery truncates text in button

Posted on 2014-02-14
2
256 Views
Last Modified: 2014-04-07
We are developing a survey module for mobiles and tablets using jquery mobile.

On screen, we present the User with a question and a number of options (responses) to select.

If the response is long we want the button to automatically size vertically and wrap the text within the horizontal width of the button.

Currently the text simply truncates so as to make it unreadable.  So as an example:

Correct Text
"I disagree completely with this statement"

Displayed Text
"I disagree comp ..."

The amount of text varies significantly for different responses, so we don't want to create a huge fixed text box just for the odd one or two long responses (it also reduces the space available for the questions)

Any ideas as to a viable solution would be greatly appreciated :)
0
Comment
Question by:Chris_Ryan
2 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
Comment Utility
Can you provide a sample code.  This seems to work fine.  http://jsbin.com/gekop/1


<!DOCTYPE html>
<html>
<head>
<link href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <button>Yes</button>
  <button>No</button>
  <button>I disagree completely with this statement</button>

</body>
</html>

Open in new window

0
 

Author Comment

by:Chris_Ryan
Comment Utility
Hi Scott,

Thanks so much for this

We are closed over the weekend, but we'll check it out on Monday and get back to you with our sample code

Cheers
Chris
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now