0

I've been trying to get a Jquery UI draggable to work, but I've run into the following error, and I cannot seem to figure out how to fix it.

Any ideas?

Screenshot error

-Edit- Here is the code:

<script>
jQuery(function() {
    jQuery( "#draggable3" ).draggable({ 
        containment: "#containment-wrapper",
        cursor: "move",
            scroll: false,
        stop: function(e , ui) {
            jQuery("#mottox").val($(this).position().left);
            jQuery("#mottoy").val($(this).position().top);
        }
    });
});​</script>
6
  • 2
    Copy the code and paste it into Notepad++ (or paste it here so we can copy it directly) to look for hidden characters. Commented Nov 6, 2012 at 16:58
  • Sometimes, the debugger cannot point the right line of a script problem if it has been loaded through AJAX. Is it the case? BTW, you don't have syntax error in the script above Commented Nov 6, 2012 at 17:00
  • Adding the code might not help as "spaces" are the most likely suspect when it comes to weird characters. Commented Nov 6, 2012 at 17:03
  • @davehale23 Yes, but if you paste it into certain editors (such as notepad++) it will let you see those odd characters that other editors won't show you. Commented Nov 6, 2012 at 17:06
  • @KevinB, I should have been more clear. What I meant was that adding their code to the question above likely would not help as the weird characters would not be visible. Commented Nov 6, 2012 at 17:36

1 Answer 1

2

There is an extra character in your code, see below:

<script>
jQuery(function() {
    jQuery( "#draggable3" ).draggable({ 
        containment: "#containment-wrapper",
        cursor: "move",
            scroll: false,
        stop: function(e , ui) {
            jQuery("#mottox").val($(this).position().left);
            jQuery("#mottoy").val($(this).position().top);
        }
    });
});?</script>
  • ^ the ? before the closing </script>

Copy the code below and use it instead:

<script>
jQuery(function() {
    jQuery( "#draggable3" ).draggable({ 
        containment: "#containment-wrapper",
        cursor: "move",
            scroll: false,
        stop: function(e , ui) {
            jQuery("#mottox").val($(this).position().left);
            jQuery("#mottoy").val($(this).position().top);
        }
    });
});</script>
Sign up to request clarification or add additional context in comments.

3 Comments

and what is the extra character?
@codingbiz the ? before the closing </script>
Ok. I didn't see it in the OP's post too. I think this should be added to SO features so we don't need special tools to find bugs like this

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.