Question: I need to get elements id and class when something is dropped on it. Id works fine, but class is not passed...

HTML

```
<div id="drag" class="two">drag</div>
<div id="drop" class="one">drop</div>

```

JS

```
$(document).ready(function(){
    $("#drag").draggable();
    $("#drop").droppable({
        drop: function(){
            alert(this.class+" "+this.id)
        }
    });

```

[jsfiddle](http://jsfiddle.net/skunksts/U5RjC/)

Answer: 
**Java Class for that :-**

```
public class NumberToWordsConverter {

        public static final String[] units = {"", "One", "Two", "Three", "Four",
                "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve",
                "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen",
                "Eighteen", "Nineteen"};

        public static final String[] tens = {
                "",        // 0
                "",        // 1
                "Twenty",    // 2
                "Thirty",    // 3
                "Forty",    // 4
                "Fifty",    // 5
                "Sixty",    // 6
                "Seventy",    // 7
                "Eighty",    // 8
                "Ninety"    // 9
        };

        public static String convert(final int n) {
            if (n < 0) {
                return "Minus " + convert(-n);
            }

            if (n < 20) {
                return units[n];
            }

            if (n < 100) {
                return tens[n / 10] + ((n % 10 != 0) ? " " : "") + units[n % 10];
            }

            if (n < 1000) {
                return units[n / 100] + " Hundred" + ((n % 100 != 0) ? " " : "") + convert(n % 100);
            }

            if (n < 100000) {
                return convert(n / 1000) + " Thousand" + ((n % 10000 != 0) ? " " : "") + convert(n % 1000);
            }

            if (n < 10000000) {
                return convert(n / 100000) + " Lakh" + ((n % 100000 != 0) ? " " : "") + convert(n % 100000);
            }

            return convert(n / 10000000) + " Crore" + ((n % 10000000 != 0) ? " " : "") + convert(n % 10000000);
        }
    }

```

**Implementation in your main class.**
You can have separate method like the follwing or you can directly use without separate method.

```
private String numToWords (int n){ //optional
        NumberToWordsConverter ntw = new NumberToWordsConverter(); // directly implement this
        return ntw.convert(n);
    } //optional

```
You have done all the work just display String returnz in a text field like this

```
 results.setText(returnz);

```