JQuery not working in JSFiddle when adding as new

狂风中的少年 提交于 2019-12-02 16:04:09

问题


This is the code

HTML

<select id="selectChange" name="selectChange">
    <option value='1' >One</option>
    <option value='2' >Two</option>
    <option value='3' >Three</option>
    <option value='4' >Four</option>
</select>

JQuery

$('#selectChange').change(function(){
        alert( $(this).val());
    });

I created a JSFiddle for JQuery on select change event. This is the link to that. As you can see, it is not working.

Then I got one JSFidle working link for JQuery on select change event form SO answer.(Don't remeber where.)

Then I updated the code to the one I already wrote in the previous link. This is the updated JSFiddle link . And it is working fine. If ypu remove the /29/ from this second URL, you can see the old JSFidle link.

You can see both the code are same. But why the first one is not working? Whenever I try to create a new JSFiddle for JQuery, I'm not able to perform it and I need to check for any already existing one and update it.


回答1:


You need to select a version of jQuery in the first drop down below the heading Frameworks & Extensions.

At the moment it's set to No library (Pure JS). This means jQuery is not available to use.



来源:https://stackoverflow.com/questions/18353124/jquery-not-working-in-jsfiddle-when-adding-as-new

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!