Np. 

I am trying to create a button element:

f.entry() {
    raw("""
        <button class="gen-secret">
            Generate Secret Token
        </button>
    """)
}

then the listener:

raw("""
    <script>
        
document.getElementByClassName("gen-secret").addEventListener('click', 
function(e) {
            e.preventDefault();
            document.getElementByClassName("secret-text").value = token;
        });
    </script>
""")


So when I click on the button it takes me to home page. How can I prevent 
this behaviour?

On Friday, May 22, 2020 at 3:51:45 AM UTC+5:30, Gavin Mogan wrote:
>
> Sorry, I got distracted when i hit enter.
> you want a click event for the button
>
> document.getElementById("buttonid").addEventListener('click', function(e) {
>        document.getElementById("idname").value = "foo";
> });
>
>
>
> On Thu, May 21, 2020 at 3:11 PM Parichay Barpanda <parichay...@gmail.com 
> <javascript:>> wrote:
>
>> Thanks Gavin. That was helpful. :)
>>
>> On Fri 22 May, 2020, 03:10 'Gavin Mogan' via Jenkins Developers, <
>> jenkin...@googlegroups.com <javascript:>> wrote:
>>
>>> document.getElementById("buttonid").addEventListener(function(e) {
>>>        document.getElementById("idname").value = "foo";
>>> });
>>>
>>> On Thu, May 21, 2020 at 2:27 PM Parichay Barpanda <parichay...@gmail.com 
>>> <javascript:>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I want to set value of a Describable field using an UI button. There is 
>>>> a text box Token and there is a button Generate, if Generate Button is 
>>>> clicked then Token text box should be filled with a desired value. 
>>>>
>>>> Thanks and Regards,
>>>> Parichay
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "Jenkins Developers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to jenkin...@googlegroups.com <javascript:>.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/jenkinsci-dev/f24e4719-9050-4470-bbb0-f09cde79d8ad%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/jenkinsci-dev/f24e4719-9050-4470-bbb0-f09cde79d8ad%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkin...@googlegroups.com <javascript:>.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_DuuZp%3DhZC7%3Dr%3DovyMVa72B9WqAV%2ByMbxx37kEA_uVqKZrw%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/jenkinsci-dev/CAG%3D_DuuZp%3DhZC7%3Dr%3DovyMVa72B9WqAV%2ByMbxx37kEA_uVqKZrw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkin...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-dev/CAD0DWAOLKjHVGPT2uYRiHDUc2H%3DEwHxmAZtu%2BFadEdVYNKzkYA%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-dev/CAD0DWAOLKjHVGPT2uYRiHDUc2H%3DEwHxmAZtu%2BFadEdVYNKzkYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/39bc0fbb-4657-4ef4-9625-d776a2a4d498%40googlegroups.com.

Reply via email to