作为新添加时,JQuery在JSFiddle中不起作用 [英] JQuery not working in JSFiddle when adding as new
问题描述
这是代码
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());
});
我在选择更改事件上为JQuery创建了JSFiddle. 这是该链接. 如您所见,它不起作用.
I created a JSFiddle for JQuery on select change event. This is the link to that. As you can see, it is not working.
然后我在选择更改事件表单SO答案上得到了一个jQuery的JSFidle工作链接.(不要记住在哪里.)
Then I got one JSFidle working link for JQuery on select change event form SO answer.(Don't remeber where.)
然后,我将代码更新为我在上一个链接中已经编写的代码. 这是更新的JSFiddle链接.而且工作正常.如果ypu从第二个URL中删除 /29/ ,则可以看到旧的JSFidle链接.
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.
您可以看到两个代码相同.但是,为什么第一个不起作用?每当我尝试为JQuery创建新的JSFiddle时,我都无法执行它,我需要检查是否存在任何已有的JSFiddle并进行更新.
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.
推荐答案
您需要在 Frameworks&标题下方的第一个下拉列表中选择jQuery版本.扩展.
此刻,它已设置为无库(纯JS).这意味着无法使用jQuery.
At the moment it's set to No library (Pure JS). This means jQuery is not available to use.
这篇关于作为新添加时,JQuery在JSFiddle中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!