jquery won’t load in footer

I wanted to move jquery to the site’s footer, but that doesn’t work. I’ve tried it with the following code. As you can see, I have a couple of another scripts and they load correctly on the footer. Only jquery won’t work. //This adds our JavaScript Files function wel_adding_scripts() { wp_deregister_script(‘jquery’); wp_register_script(‘jquery’, ‘http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js’, ”, ‘2.1.1’, … Read more

How to scroll to top of page with JavaScript/jQuery?

Is there a way to control browser scrolling with JavaScript/jQuery? When I scroll my page half way down, then trigger a reload, I want the page to go pack to the top, but instead it tries to find the last scroll position. So I did this: $(‘document’).ready(function() { $(window).scrollTop(0); }); But no luck. EDIT: So … Read more

Turn jQuery.ajax() request into XMLHttpRequest (vanilla JavaScript)

Been looking for some help changing a jQuery.ajax() request into vanilla XMLHttpRequest for WordPress, but not really finding what I want. Can anyone help me reformat the below into vanilla JavaScript XMLHttpRequest? $.ajax({ data: { ‘action’: ‘work_hour_form_handler’, ‘work_hours_start’: document.getElementById(‘work-hours–start’).value, ‘work_hours_end’: document.getElementById(‘work-hours–end’).value, ‘break-hours_start’: document.getElementById(‘break-hours–start’).value, ‘break-hours_duration’: document.getElementById(‘break-hours–duration’).value, ‘working_days’: document.getElementById(‘working-days’).value }, headers: {}, method: ‘post’, url: fpm_ajax.ajax_url }).done(function … Read more

What do I need jQuery for?

What do you think of killing jQuery in the public facing WP site? Isn’t it useless and making for slower page loading? What’s the best way to get rid of it? 5 Answers 5 jQuery is loaded by the theme that you use and not by WordPress. The theme must be modified to not load … Read more

How to Display Selected Item in Bootstrap Button Dropdown Title

I am using the bootstrap Dropdown component in my application like this: <div class=”btn-group”> <button class=”btn”>Please Select From List</button> <button class=”btn dropdown-toggle” data-toggle=”dropdown”> <span class=”caret”></span> </button> <ul class=”dropdown-menu” role=”menu” aria-labelledby=”dropdownMenu”> <li><a tabindex=”-1″ href=”#”>Item I</a></li> <li><a tabindex=”-1″ href=”#”>Item II</a></li> <li><a tabindex=”-1″ href=”#”>Item III</a></li> <li class=”divider”></li> <li><a tabindex=”-1″ href=”#”>Other</a></li> </ul> </div> I would like to display the … Read more

Jquery: how to trigger click event on pressing enter key

I need to execute a button click event upon pressing key enter. As it is at the moment the event is not firing. Please Help me with the syntax if possible. $(document).on(“click”, “input[name=”butAssignProd”]”, function () { //all the action }); this is my attempt to fire click event on enter. $(“#txtSearchProdAssign”).keydown(function (e) { if (e.keyCode … Read more

How to select html nodes by ID with jquery when the id contains a dot?

If my html looked like this: <td class=”controlCell”> <input class=”inputText” id=”SearchBag.CompanyName” name=”SearchBag.CompanyName” type=”text” value=”” /> </td> How could I select #SearchBag.CompanyName with JQuery? I can’t get it to work and I fear it’s the dot that’s breaking it all. The annoying thing is that renaming all my id’s would be a lot of work, not … Read more