Hi,
I am trying to get a JQuery code converted into JavaScript, as JQuery is not available.
Would anybody be able to help me please?
This is the code: $(document).ready(function(){ $('#login-trigger').click(function(){ $(this).next('#login-content').slideToggle(); $(this).toggleClass('active'); if ($(this).hasClass('active')) $(this).find('span').html('▲') else $(this).find('span').html('▼') }) });
Thanks
I am trying to create a drop down log-in box for my wordpress site, but the theme only has a section to insert custom JS, but the code is JQuery, how can I get it to work with JS?
It would help if we knew a little more about this particular instance of WP. Is it a site hosted at wordpress.com, or is it a personally installed one? Is there access to cpanel? What’s the theme being used?
It maybe that there are other ways to ‘place’ the code, rather than trying to enter it via, what appears to be, a back-office text box.
It’s a personally installed one, I have access to the cpanel. There are some files in the JS folder such as jquery.js, would I just put the code in there? I have no knowledge of JQuery or JS.
I’ve managed to get it to work on all the pages besides the homepage. Don’t know why.
This is the full code for the buttons in the header: <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'>$(document).ready(function(){ $('#login-trigger').click(function(){ $(this).next('#login-content').slideToggle(); $(this).toggleClass('active'); if ($(this).hasClass('active')) $(this).find('span').html('▲') else $(this).find('span').html('▼') }) });</script><nav> <ul2> <li id='login'> <a id='login-trigger' href='#'> Login <span>▼</span> </a> <div id='login-content'> <form> <fieldset id='inputs'> <input id='username' type='email' name='Email' placeholder='Your email address' required> <input id='password' type='password' name='Password' placeholder='Password' required> </fieldset> <fieldset id='actions'> <input type='submit' id='submit' value='Log in'> <label><input type='checkbox' checked='checked'> Keep me signed in</label> </fieldset> </form> </div> </li> <li id='signup'> <a href=''>Sign Up</a> </li> </ul2> </nav>
Also if it is wp:
is the jquery actually enqueued in the functions.php?
Because i know from experience it is not always. And is your script enqueued there as well?
And are they enqueued as true of false?
Just how much access do you have to your theme?
D