Reputation:
I know adding this question is a long shot from anyone even wanting to answer due to having to wade through all my JQuery script to resolve any problems I am currently experiencing, however I do not know where else to look.
Live View: https://tornhq.com/WorkingOn/Account/Management/PageBuilder/box.html
I have recently implemented so you can have more than one drop down with very slight modifications when you implement another, however I am having some problems doing the following;
This is my first really JQuery script whereas anything else I have done as mainly been snippets from here and there and whatnot. I don't know how to resolve these problems and I am, at this moment at a complete loss.
Thank you so very much for any time spent in helping and any help and/or advice you provide,
Best Regards,
Tim
Upvotes: 0
Views: 106
Reputation: 2474
You're right, lots of stuff going on here...
1) Why a mousedown and a click event handler on the same selector that essentially does the same thing?
2) instead of mouseover and mouseout, I would probably use hover, or try to use CSS only if all you are doing is modifying CSS.
3) var state = false; at line 85 is global, and cannot be uniquely used by multiple objects. If you need to set some state property on an individual element, use the data property of the element instead.
4) Remember, when using jQuery, you are normally dealing with a SET of matched elements, not just one. So you need to make sure you are dealing with the one element you want.
5) Just one example of how I might write one part of your code:
Instead of:
$('.Row1 input:text').mouseover(function () {
var thisParent = $(this).parent().attr("id");
if (!FZTxtInputState) {
$("#" + thisParent + " .DropBtn").css({
I would:
$('.Row1 input:text').mouseover(function () {
if (!FZTxtInputState) {
$(this).closest(".DropBtn").css({
This won't solve all your problems, but I can at least see you are trying to learn jQuery!
Upvotes: 1