Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is the jquery script not working?
    text
    copied!<p>Why is the jQuery script working in my jsfiddle but not in my page? </p> <p>What I've done: Tried different versions of JQuery...made the script</p> <p>So I have this test page:</p> <h2>Head Part</h2> <pre><code> &lt;!-- Scripts --&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"&gt;&lt;/script&gt; &lt;style&gt; select #canselect_code { width:200px; height:200px; } .fr { float:right; } .fl { float:left; } &lt;/style&gt; &lt;script&gt; $(document).ready(function(){ $('[id^=\"btnRight\"]').click(function (e) { $(this).prev('select').find('option:selected').remove().appendTo('#isselect_code'); }); $('[id^=\"btnLeft\"]').click(function (e) { $(this).next('select').find('option:selected').remove().appendTo('#canselect_code'); }); }); &lt;/script&gt; &lt;/head&gt; </code></pre> <h2>Body Part</h2> <pre><code> &lt;div&gt; &lt;select id='canselect_code' name='canselect_code' multiple class='fl'&gt; &lt;option value='1'&gt;toto&lt;/option&gt; &lt;option value='2'&gt;titi&lt;/option&gt; &lt;/select&gt; &lt;input type='button' id='btnRight_code' value=' &gt; ' /&gt; &lt;br&gt; &lt;input type='button' id='btnLeft_code' value=' &lt; ' /&gt; &lt;select id='isselect_code' name='isselect_code' multiple class='fr'&gt; &lt;option value='3'&gt;tata&lt;/option&gt; &lt;option value='4'&gt;tutu&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p><a href="http://jsfiddle.net/7785m/" rel="noreferrer">JSFIDDLE HERE</a></p> <p>Now my question is: Why is the code working in JsFiddle but not in my document?</p> <p>Thanks for your answers!</p> <p>EDIT: Added document ready function..still does not work!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload