Loading...
 

Development


Hiding Div with JQ and Pretty Tracker

posts: 41 US

Hello,

I currently am using a pretty tracker and am focused on the template page.

I currently have this iterated on my template to display tracker fields:

Release Notes:

{$f_14}


My goad is to hide the div("release") using JQ. I believe I am following the right path by using:

if (!$("#ins_14").val()) {
$("#release").hide();
}else{
$("#release").show();
}
//else my be unnecessary

FYI i have tried to substitute .val() with .text()

This code will not cooperatre on the template level it seems like.
This was originally posted in Features / Usability, I had no responses so i thought I would put it here in dev.

Any ideas are welcome!

Thanks.

posts: 1783 Catalan Countries

I presume that you don't need the{CODE()}

{HTML(wiki="1")}

{CODE}

part.

 

I guess that you need to surround with a

{DIV(id="release")}

your relese info

{DIV}

 

so that your jquery code finds the div "release" and hides it as you expect.



 

And for the condition, in case it doesn't work (I'm not an expert in jquery), you can try to check against empty value or something like: 

if ($("#ins_14").val() === '') {


I hope this helps.

posts: 41 US

Thanks for the quick reply!

I am having trouble understanding what you mean by this:

"I guess that you need to surround with a

your release info, so that your jquery code finds the div "release" and hides it as you expect."

 

Did something get removed from "I guess that you need to surround with a" it seems like you were cut off. 

 

Thanks!


posts: 944 Catalan Countries
try now (it was my fault indeed , I forgot to escape the plugin div code with a plugin code .)

posts: 1533

Hi Avocado,

are you using {$f_14} in a template page for another wiki page (view page) which should work in conjunction with a plugin List or a plugin Trackerlist, or are you using the {$f_14} directly in the initial view page, which would likely not work.

Normally you need a template with all the fields variables plus wikisyntax for design.

Then a wiki plugin in the initial page where in the plugin you refer to the template page and the default plugin output will be replaced by the templates output (data from template, design and fields by the template).

posts: 41 US

Hi Torsten,

I am using a pretty tracker with a template, and tracker page, as normal. I am ONLY using  {$f_14} on the template page, but I am also using $("#ins_14") on the template page, with JQ. 

I have switched my code, under instruction of another user, to use the integraded {DIV} instead of the HTML based. Here is where I am now:

Release Notes

{$f_14}


And using this as my JQ:

{JQ()}if (!$("#ins_14").val()) {
 $("#release").hide();
}else{
 $("#release").show();
}{JQ}

 


 

 

posts: 41 US

Its interesting that when I use the above JQ code, the DIV is hidden if there is something or nothing. So i know that that jq with the DIV is working, because it is hiding it. I think that my problem is understanding how to say "Does my text area field 'Release Notes' have any text in it?

I have tried

if (!$("#ins_14").text())

if (!$("#ins_14").val().text())

if ($("#ins_14").val() === '')

if ($("#ins_14").val() === "")

if ($("#ins_14").text() === '')

if ($("#ins_14").text() === "")

Some hide both empty and filled test cases while some show both.


Why Register?

Register at tiki.org and you'll be able to use the account at any *.tiki.org site, thanks to the InterTiki feature. A valid email address is required to receive site notifications and occasional newsletters. You can opt out of these items at any time.