javascript - Read more opens 1st one all the time -


I have a page with about 10 short articles

as each of them read "Read more "Button is pressed, which displays the hidden text that is pressing

" Read more "button 10 on one of the issues I have at the moment, this first article shows hidden content and selected is not.

I think I need to set a unique ID for each article .. and the Read more button should be linked. But I do not know how to set it up.

I looked at it, but it could not work

  var widget contenthide display = {init: function () {if ($ ('$ content-display-hide '). Size () == 0) Return; $ ('Triggerable') click (function (e) {var element_id = $ (this) .attr ('rel'); var element = $ ('#' + element_id); element.toggle (); if (Element.is (': visible')) {$ ('. Readmore'). Hide ();} and {$ ('. Readmore'). Show ();} Return false;}); }} Var div = documentElemnt ("div"); Div.id = "div_" + New Date () Gettime (). ToString; $ (Document) .ready (function () {WidgetContentHideDisplay.init ();});   

Edit OPP: Sorry, the original code was not in the caps. I was getting errors while trying to post, so I copied the code and in Dreamweaver it made all the caps for some reason.

element to toggle with an ID (i.e. $ ('#' + ELEMENT_ID) ) Instead of selecting, you can set up a class for your item and use class selection

In theory, each ID (such as $ ('.dietized-paragraph)' < / Code>) to select the child (or brother, etc.) should point to an element, but you can put each class in as many elements as you want.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -