Question: I want to get current class value `<input type="text" id="contact_name1" name="name1"/>` In js i want to call like this `$('#contact_name1').on('input', function() { }`.

my question is how to write after underscore current class.
`$(#contact_"")`? `name1` changes for all classes.

Answer: 
You could use the *starts with* `^=` operator inside the attribute selector:

```
$("[id^='contact_']").on("input", fn);

```

```js
$("[id^='contact_']").on("input", function() {

  var suffix = this.id.split("_")[1];
  console.log( "ID: %s SUFFIX: %s", this.id, suffix );

});
```

```html
<input id="contact_name" name="name" type="text">
<input id="contact_surname" name="surname" type="text">
<input id="contact_email" name="email" type="text">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
```
i made this exemple few days ago 

```
<script>

$("input").click(function(){ 
    var res="#"+$(this).attr('id') 
    $(res).show() 
});
</script>

```

just create a variable who contains the entire text and after this you can lauch your function :)