javascript - how to add an onclick event to a primefaces growl? -


I have a problem adding any event to a growr element. My goal is to right-click on it to stop the growl To do.

I tried different solutions and my grief looks like this:

   

First I tried to do something like this in my Javascript code:

  $ ('#growl'). OnClick (function () {Warning ('Test !!!'}});  

I swapped "#growl" for ".ui-growl", ".ui-growl-item" and ".ui-growl-item-container", but no one With no effort.

Then I thought that when the javascript is provided, the bully element has not been sung, and I tried to keep my JavaWork directly in the form and updated it with the command button. So this part was in direct form:

  & lt; H: Panel Group id = "JS" & gt; & Lt; Script type = "text / javascript" & gt; $ ('# Goon'). OnClick (function () {warning ('test !!'}}); & Lt; / Script & gt; & Lt; / H: panelGroup & gt;  

... did not work as well.

Just adding an onclick = "..." property was not working and I can not add an element because a thunder is just a message and its interface is missing.

I am out of ideas, do you have any suggestions? I do not want a button to turn it off, and I got it to stop with the help of this answer with a left click:

But it's still not exactly what I wanted.

The best solution would be: $ ('# mounting'). Mousudown (event) {...}

I know that there is no other way to press the button, the mouse button.

I hope someone

Edit


Edit:

Thank you for your suggestions.

Your comments After I tried to use it: $ ("# Login Form \: Grully_ Container") is ready (...) and it works. That's why I think it's the right way to my element

But:

  $ ("# Login Form \\: growl_container"). Click () and $ ("# Login Form \\: growl_container") Mousedown ()  

is still not working: '- (

I tried to update them in my panel element, but without success Also.

I tried to click on the events inside my form and with other elements, and do its job. I think that should be something special with this P: Grow Wl or h: Message Element.

Since p: gorran is inside h: form You can not access p: tickling via your code.
Attach form ID when entering it.

And one more thing is that the prefix engages the text _container at the end of your P: tickety id.

& lt; P: growl id = "myGrowl" & gt; ... & lt; / P: Gurna & gt;

Then the ID will be: myGrowl_container

Example:

  $ ("# LoginForm \\: Growl_container ")  

and also using Jquery like one of the question comments while trying to use click () .


Comments