Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

jquery - JavaScript function works in JsFiddle but not in .net Partial view

I have an event that I want to fire on keyup of an input. the code works perfectly fine in JsFiddle, but when I run in .NET MVC Partial view, nothing happens.

so for example this is the JsFiddle

exactly the same code (except the part with click me, to add text field) does not work in my view. What is even stranger that this code:

$(document).on("keyup","#propName", function () {
   alert($("#propName").val());
});

works without any problems and the event is fired, but as soon as I add an IF statement the code is not executing at all (also no error messages in the console) What am I doing wrong?

question from:https://stackoverflow.com/questions/65847412/javascript-function-works-in-jsfiddle-but-not-in-net-partial-view

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...