onclick - jQuery click to change CSS -
i have simple question don't know how accomplish this. know have utilize click()
function.
basically, have div id #box1
. applied css style overflow:auto
there vertical scroll-bar if table length (a long table within #box1) exceeds width of div #box1
.
now wanted add together link below div. link should following:
on-click, add together css div#box1
overflow:auto
overflow:visible
simultaniously, while changes css above, link should alter display new link (the old 1 disappears) alter css overflow:auto
when clicked.
you can utilize css
method.
$('#mybutton').click(function(event) { event.preventdefault(); $('#box1').css('overflow', function(i, o) { homecoming o == 'auto' ? 'visible' : 'auto'; }) });
and instead of hiding/showing 2 different buttons, can utilize text
method:
$('#mybutton').click(function(event) { // ... $(this).text(function(i, text){ homecoming text == 'show' ? 'hide' : 'show'; }) });
http://jsfiddle.net/u6nc8/
jquery onclick
No comments:
Post a Comment