9/14 What is purpose of selectable


#1

I went through the lesson (9/14) and it worked, but I wonder what the selectable do ?, just to highlight it?.

<head>
	<title>Select Ye Favorite</title>
    <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
    <script type='text/javascript' src='script.js'></script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
</head>
<body>
    <ol>
        <li>Super Mario Bros.</li>
        <li>Tetris</li>
        <li>Legend of Zelda: Link's Awakening</li>
        <li>Kirby's Dream World</li>
        <li>Burger Time</li>
        <li>Pokémon Red</li>
        <li>Pokémon Blue</li>
    </ol>   
<div id="appendHere">
</div>
</body>

I changed script.js like this

$(document).ready(function(){
$('ol').selectable();
$('ol').selectable( {appendTo: "#appendHere"});
});

Nothing happend after select a element, so how can I do it?


#2

Errr... The issue should be here?

You should only do this:

$(document).ready(function() {
    $('ol').selectable();
    });

selectable is an event
Hope this helps!:smiles


#3

Hi,
I want the selected element append to element has id #appendHere, it is why I added > $('ol').selectable( {appendTo: "#appendHere"}); line, but nothing happen.


#4

Okay!

$( ".selector" ).selectable({
  appendTo: "#someElem"
}); //this will initialize the selectable event

//to get and set the appendTo

// Getter
var appendTo = $( ".selector" ).selectable( "option", "appendTo" );
 
// Setter
$( ".selector" ).selectable( "option", "appendTo", "#someElem" );

#5

Yeah, I followed this as about code but I don't work.

$( ".selector" ).selectable({
appendTo: "#someElem"
}); //this will initialize the selectable event