Function myFunction and $('body').on('click', function() {
Solved
rasielblas
Posted messages
143
Status
Member
-
rasielblas Posted messages 143 Status Member -
rasielblas Posted messages 143 Status Member -
Hello,
Actually, I have two functions that each have their role, but I would like to combine them because I need to
- The first function allows selecting a div called mainContainer and filtering its children:
And I would like to do the same thing with the second function, but I don't know how to proceed; here is the code:
So what I want is something like:
But from what I see, it’s not how it should be done and it doesn't work, so I would like to ask if you could help me fix this last code.
Best regards,
Actually, I have two functions that each have their role, but I would like to combine them because I need to
- The first function allows selecting a div called mainContainer and filtering its children:
$('body').on('click','#mainContainer :not(.PDFPage):not(.element)', function() { alert("The child of the main container is properly filtered and not selected"); }); And I would like to do the same thing with the second function, but I don't know how to proceed; here is the code:
function shownToolColor(x,y,width,isVisible,container) { alert("The child of the main container is properly filtered and not selected"); }); So what I want is something like:
$('body').on('click','#mainContainer :not(.PDFPage):not(.element)', function shownToolColor(x,y,width,isVisible,container) { alert("The child of the main container is properly filtered and not selected"); }); But from what I see, it’s not how it should be done and it doesn't work, so I would like to ask if you could help me fix this last code.
Best regards,
1 answer
-
Hello,
To start.... what is the function shownToolColor called in your code?
(what triggers it?)
Because .... when you say you want to "merge" .. what do you mean?
Right now you have:
code that runs when you click on your page (which does not contain the pdf class or element)
The code that is executed then is:alert("The child of the main container is well filtered and is not selected");
Then you have a function (which we don't know how/where you call it) that executes the codealert("The child of the main container is well filtered and is not selected");
I think I understand that you want, in your click$('body').on('click','#mainContainer :not(.PDFPage):not(.element)'
to call the function shownToolColor
In that case:$('body').on('click','#mainContainer :not(.PDFPage):not(.element)', function() { //------------------------------------------------------// // Variables to complete .... //------------------------------------------------------// var x = ""; var y = ""; var isVisible = ""; var container = ""; //------------------------------------------------------// // Launching the function //------------------------------------------------------// shownToolColor(x,y,width,isVisible,container); });
It's up to you to fill in the different variables.... I don't know what values you are expecting exactly.
--
Best regards,
Jordane