jquery - Change text from <h1> tag to one from a different div -
i'm trying alter text within tag 1 selected element list.
this list:
this corresponding html (just part of it)
<div class="categories"> <div class="cats"><a id="categoriabtn995" class="button" href="#categorytitle" title="button">lĂnea blanca</a></div> <br> <div class="cats"><a id="categoriabtn996" class="button" href="#categorytitle" title="button">desarrollo de software</a></div> <br> <div class="cats down"><a id="categoriabtn998" class="button" href="#categorytitle" title="button">esteticas - belleza</a></div> <br> <div class="cats"><a id="categoriabtn999" class="button" href="#categorytitle" title="button">publicidad</a></div> <br> </div>
under div, have section want set info elements.
first, need alter title simple tag:
<h1 id="categorytitulo">change this</h1>
it should alter text element class="down"
this how toggle class:
$(document).ready(function () { $('a.button').click(function () { $('.down').toggleclass("down"); $(this.parentelement).toggleclass("down"); }); });
and i'm trying right now:
$('a.button').click(function () { $('h1#categorytitulo').text( $('.down').text()); });
i tried place in jsfiddle , reason works there, not on site. hope guys can help me figure out method accomplish this.
this i'm trying achieve: http://jsfiddle.net/2maft/ not working me.
you need alter a#categoriabtn run off of class not id. like;
$('a[class$="button"]').click(function(){ $("#categorytitulo').html('whatever want here'); });
i don't know you're getting classname of downwards or else, should work on whatever want
jquery html
No comments:
Post a Comment