How to create a help Function

Asked

Viewed 31 times

0

How can I implement a feature in jQuery / Javascript that a question mark type appears as soon as the user has 2 clicks on one TextBox and when he clicks on that question mark, Help how he can correctly fill the field appear?

  • 1

    Have you managed to structure your HTML? Can [Edit] the question by entering this code? Have you managed to handle the double-click event in the field? The only problem is showing the help icon and its message?

  • @Andersoncarloswoss HTML is already structured, because I will implement this in application of the company I work for. The problem is just the double click and show the help icon and its message.

  • Do you use Bootstrap? You could use the tooltips to display the help text.

2 answers

2


$('#input').on('dblclick', function(){
  $('#help').show()
})
#help{
  display: none;
}


a.tooltips {
  position: relative;
  display: inline;
}
a.tooltips span {
  position: absolute;
  width:140px;
  color: #FFFFFF;
  background: #000000;
  height: 30px;
  line-height: 30px;
  text-align: center;
  visibility: hidden;
  border-radius: 6px;
}
a.tooltips span:after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  width: 0; height: 0;
  border-top: 8px solid #000000;
  border-right: 8px solid transparent;
  border-left: 8px solid transparent;
}
a:hover.tooltips span {
  visibility: visible;
  opacity: 0.8;
  bottom: 30px;
  left: 50%;
  margin-left: -76px;
  z-index: 999;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label>
  De dois cliques em caso de duvida
  
  <a id="help" class="tooltips">
<img src="https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-help-128.png" width="30">
<span>MENSAGEM;)</span>
  </a>
</label>
<input type="text" id="input">

You can do so with jQuery

0

From what I understand, when you click 2 times in the text box it should show a help text...
To do this, seven an id to your textbox and make the field with the query come hidden and through jquery make a function that is called in the double click of that id. Example :

$( "#seu_id" ).dblclick(function() {
  $("#id_da_interrogacao").show();
});
$("#id_da_interrogacao").click(function(){
  //faça aqui seu código para mostrar o texto
})

Browser other questions tagged

You are not signed in. Login or sign up in order to post.