javascript - Adding an anchor to generated URLs -
I tried to find a simialr example and used to answer my problem, but let me do this work Can not seem to be so, if it sounds like other problems, then apologizes.
Actually, I'm using Terminal Four's Site Manager CMS system so that my websites can be ready. This tool allows you to generate navigation elements for use through your site.
I need to add a custom bit of JS to add these links to a linker.
The generated link is similar to this:
& lt; Ul id = "tab-menu" & gt; & Lt; Li & gt; & Lt; A href = "/ section / page" & gt; Test link, I can rewrite an anchor !!! & Lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; I can edit the CSS properties of the link, but I did not know how to add anchor.
The jQuery I am using is as follows:
& lt; Script type = "text / javascript" src = "http://jquery.com/src/jquery-latest.pack.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {// Everything goes here $ ("# tab menu") Children ("li") Each (function () {$ (this). Child ("a" ) .css ({color: "red"});});}); & Lt; / Script & gt;
A good jQuery-based method. ) Method, which gives you access to the JavaScript link object, which has the property named 'hash' which represents the anchor part of the URL. Then modify your code slightly:
& lt; script type = "text / javascript" & gt; $ (document) .ready (function () {// Everything goes here ("# tab menu") Children ("le"). Children ("a"). Get each (function () {$ (this) .css ({color: "red"}) (0) .hash = "boom";} );});
All links will change in "#tab_menu li" for red, and at the end, "#boom" can be attached. < / P>
Hope it helps!
Comments
Post a Comment