121
rated 0 times
[
122]
[
1]
/ answers: 1 / hits: 23485
/ 9 Years ago, mon, january 4, 2016, 12:00:00
I'm stuck with html/JS and have no idea how I should handle some events.
For example I have a list-group:
<div class=col-lg-3 col-md-3 col-sm-3 opciones>
<div class=list-group>
<a href=# class=list-group-item active>
Tokyo
</a> // barfoobarfoo
<a href=# class=list-group-item>London</a> // foo
<a href=# class=list-group-item>Paris</a> // bar
<a href=# class=list-group-item>Moscow</a> // foobar
<a href=# class=list-group-item>NY</a> //foobarfoo
</div>
</div>
What I want to do is:
1)change active elements on click.
2)call JS function when element is clicked.
UPD:
So now I know that click events can be handled with JQuery thing.
What I can't understand is to how to determinate which element is clicked. For example JQuery:
$('.list-group-item').on('click', function() {
$this = $(this);
$('.active').removeClass('active');
$this.toggleClass('active')
function simpleFunc(someargument) { //value of this argument depends on clicked item and can be (foo|bar|foobar ) etc
document.write(someargument) // here whould be written some text (foo|bar|foobar ) etc
})
There are no tutorials or anything, except this HTML code.
Thanks
More From » twitter-bootstrap