Activate click on div!

As I put an onclick inside a div, I didn’t find this option!


In the attributes tab (Bottom Left of Screen)

Add onclick where it says key, and then your script in value

I’ll put it this way you told me, where do I learn about these increments?

Bootstrap Studio Docs | Bootstrap Studio is a good place to start

It didn’t work out friend, but thank you very much for your help if you can point me to a youtube channel where I can learn a lot I would appreciate it!


It worked friend thank you very much!

Can anyone tell me why the letter (clicked) is not white too?

function clicar(){
    var a = window.document.getElementById('area')
    a.innerText= ('CLICOU!!!')
<a href="">

And remember you can make links display: block;, so the whole rectangular area becomes “clickable”. But, if there is a ton of content in there, it’s absolutely horrible for accessibility, reading all that content as the interactive link.

If you absolutely need to use JavaScript, one way is to find a link inside the div and go to its href when the div is clicked. This is with jQuery:

$(".myBox").click(function() {
  window.location = $(this).find("a").attr("href"); 
  return false;

Looks for a link inside div with class of “myBox”. Redirects to that links value when anywhere in div is clicked.

Reference HTML:

<div class="myBox">
  blah blah blah.
  <a href="">link</a>

Or, you could set a data-* attribute on the <div data-location=""> and do like:

window.location = $(".myBox").data("location");