javascript - JSfiddle code is not working -
i trying transfering elements 1 listbox listbox in html. using below code:
question ::--this code found link stackoverflow redirects jsfiddle site, working on site not working here??
<html> <header> <script type="text/javascript"> $(function(){ $("#button1").click(function(){ $("#list1 > option:selected").each(function(){ $(this).remove().appendto("#list2"); }); }); $("#button2").click(function(){ $("#list2 > option:selected").each(function(){ $(this).remove().appendto("#list1"); }); }); }); </script> </header> <body> <div> <h3>list a</h3> <select id="list1" multiple="multiple" rows=2> <option value=1>option 1</option> <option value=2>option 2</option> <option value=3>option 3</option> <option value=4>option 4</option> </select> <br/> <input id="button1" type="button" value="move list b" /> </div> <div> <h3>list b</h3> <select id="list2" multiple="multiple" rows=2> </select> <br/> <input id="button2" type="button" value="move list a" /> </div> </body> </html>
i know silly question beginner.
what did wrong here?? please me ..
add jquery file in <head></head>
section this
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
then works fine.
Comments
Post a Comment