Try moving your <script> block after your HTML elements so the page has already loaded before you assign your script events. Secondly don't use jQuery .bind as it has been deprecated https://api.jquery.com/bind/#bind-ev...ntData-handler ; use .on instead.
Try moving your <script> block after your HTML elements so the page has already loaded before you assign your script events. Secondly don't use jQuery .bind as it has been deprecated https://api.jquery.com/bind/#bind-ev...ntData-handler ; use .on instead.
Hi
Thanks for the comment, unfortunately i tried but nothing works. still the same.
Then click on it; it should work fine (at least it did for me once I'd added the ID='submitImage' to the element). So try moving your jQuery into a code block which attaches the events to the elements once the page has loaded:
Code:
require(["jquery", "utility"], function ($, MO) {
$(function() {
$("#username").on("focus", function () {
$("#username").parent().removeClass("error");
});
$("#submitImage").on("click", function (event) {
var prefix = "http://";
var suffix = "-remoteally.viewnetcam.com:40040";
var myURL = prefix + $("#username").val() + suffix;
if (!MO.isBlank($("#username").val())) {
window.location.href = myURL;
}
else {
$("#username").parent().addClass("error");
}
});
});
});
The other useful thing to do with the Developer tools active is find the code where there are problems and add a breakpoint so you can (a) see that the click is being activated, and (b) see what happens during the course of the event.
Then click on it; it should work fine (at least it did for me once I'd added the ID='submitImage' to the element). So try moving your jQuery into a code block which attaches the events to the elements once the page has loaded:
Code:
require(["jquery", "utility"], function ($, MO) {
$(function() {
$("#username").on("focus", function () {
$("#username").parent().removeClass("error");
});
$("#submitImage").on("click", function (event) {
var prefix = "http://";
var suffix = "-remoteally.viewnetcam.com:40040";
var myURL = prefix + $("#username").val() + suffix;
if (!MO.isBlank($("#username").val())) {
window.location.href = myURL;
}
else {
$("#username").parent().addClass("error");
}
});
});
});
The other useful thing to do with the Developer tools active is find the code where there are problems and add a breakpoint so you can (a) see that the click is being activated, and (b) see what happens during the course of the event.
Hi
Thanks for this do you have a clear explanation? you said moving the jquery block?
You're calling "require" and then attaching the event handlers:
Code:
require(["jquery", "utility"], function ($, MO) {
$("#username").on("focus", function () {
$("#username").parent().removeClass("error");
});
// etc.
});
So put those event handlers for username and submitImage INSIDE a jQuery on document load call, i.e.
Code:
require(["jquery", "utility"], function ($, MO) {
$(function() { // <--- new bit
$("#username").on("focus", function () {
$("#username").parent().removeClass("error");
});
// etc.
}); // <--- end of new bit
});
That way it will run after the document has been loaded and the event handlers will attach correctly.
Would you please post your code as that image is too low a resolution to read. I suspect you have simply not closed code brackets and / or braces but I can't really see.
When posting please put (omit the spaces)
[ c o d e ]
before the code, and (again omit the spaces)
[ / c o d e ]
after it so it appears as highlighted code.
Would you please post your code as that image is too low a resolution to read. I suspect you have simply not closed code brackets and / or braces but I can't really see.
When posting please put (omit the spaces)
[ c o d e ]
before the code, and (again omit the spaces)
[ / c o d e ]
after it so it appears as highlighted code.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.