Yes, that looks broadly correct (barring a missing '
). That isn’t a jQuery $
, so shouldn’t cause any problems – the dollar prefix here is the usual convention for PHP variable names and won’t make it into the included script.
Or if I’ve misunderstood and you meant your ie.js script assumes jQuery is $
then you can solve that by wrapping it in a self-executing function which defines a scope where $ = jQuery, e.g.
(function($){
...
})(jQuery);
Also as of 4.2 there’s a helper function wp_script_add_data so you can write instead:
wp_register_script( 'ie_js', '/js/ie.js', array(), '' );
wp_script_add_data( 'ie_js', 'conditional', 'lt IE 9' );
Related Posts:
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- How do I redirect to another webpage?
- Invariant Violation: Objects are not valid as a React child
- How to get all place details from a Place Details Request using Google Places API Web Service?
- How do I check whether a checkbox is checked in jQuery?
- SyntaxError: Unexpected token o in JSON at position 1
- What does the function then() mean in JavaScript?
- Heroku: “No default language could be detected for this app” error thrown for node app
- Loop inside React JSX
- Can’t resolve module (not found) in React.js
- Is there a difference between /\s/g and /\s+/g?
- How do I loop through or enumerate a JavaScript object?
- Getting Unexpected Token Export
- Setting a backgroundImage With React Inline Styles
- Filter array to have unique values
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Mouseover & Mouseout w/ Javascript
- Format JavaScript date as yyyy-mm-dd
- Programmatically change the src of an img tag
- Unable to preventDefault inside passive event listener
- JavaScript variable assignments from tuples
- jQuery $.cookie is not a function
- Setting background-image using jQuery CSS property
- Scroll Automatically to the Bottom of the Page
- npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself
- How do I check if string contains substring?
- What does “export default” do in JSX?
- Cannot find module ‘internal/fs’ after upgrading to node 7
- How can I select an element by name with jQuery?
- How can I group data with an Angular filter?
- blocked a frame of origin “null” from accessing a cross-origin frame – chrome
- How can I resolve the error “URL scheme must be “http” or “https” for CORS request.” for this code [duplicate]
- Initializing an Array with a Single Value
- Is it possible to stop JavaScript execution?
- Remove commas from the string using JavaScript
- How can you remove all documents from a collection with Mongoose?
- TypeError: ‘undefined’ is not an object
- Uncaught TypeError: Cannot read property ‘appendChild’ of null
- javascript setTimeout() not working
- JQuery issue “TypeError: $.getJSON is not a function”
- Retrieve the position (X,Y) of an HTML element
- command not found: jest
- How to access Session variables and set them in javascript?
- Google Maps JS API v3 – Simple Multiple Marker Example
- HTML onchange (this.value)
- Angular 2 Hover event
- getElementsByClassName not working [duplicate]
- Javascript: Unicode string to hex
- Preloading images with jQuery
- socket.io – ReferenceError: io is not defined
- What is the difference D3 datum vs. data?
- How to check if a number is between two values?
- How to determine if Javascript array contains an object with an attribute that equals a given value?
- Must use destructuring props assignment
- Line continuation characters in JavaScript
- Simulate a click on ‘a’ element using javascript/jquery
- How can I remove a style added with .css() function?
- Error: Couldn’t find preset “es2015” relative to directory “/Users/username”
- Using Angular 2 without TypeScript Transpiler
- Trigger Javascript on Gutenberg (Block Editor) Save
- How to intercept already localized scripts
- Customizer JS API
- Show control conditionally in Gutenberg
- Want image captions to be from img ALT tags not title tags
- How to get the ToggleControl Gutenberg component working for a PHP Block
- How to append a URL parameter to all outbound URLs
- wp_customize_support_script – do I need it?
- How to add a “data-” attribute to the image tag of native gallery output
- Post to WordPress using REST API from external site
- Javascript Helpers
- Rest API invalid nonce with Backbone Client
- Set current tab on a Gutenberg TabPanel component from outside that component
- Gutenberg block “This block appears to have been modified externally” on save
- 404 Error Contact Form 7 on WordPress
- Enqueue script if screen is greater than 500
- window.send_to_editor throws unterminated string literal error when adding image with multi line description
- Gutenberg get core data – search
- Correctly enqueue scripts of type=text/paperscript (PaperJs Library)
- useSelect second parameter
- Javascript in wordpress
- How do I make my wordpress post appear in a mouse hover preview?
- Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page [closed]
- How to inherit custom javascript from parent to child pages?
- jQuery UI Tools: Scrollable: More than 1 instance possible?
- imporing HTML+javascript from REST API
- how to add a custom javascript file to our theme
- Check if user can in javascript
- Why does my array sort order changes when I pass it to JS using WP_REST_Response?
- WordPress Guternberg Content For React Native
- Custom block update rendering when reused
- VisualComposer/WPBakery Page Editor: Is any JS event triggered after the Edition pop-in is shown?
- How do I add my own scripts to the add_action(‘wp_enqueue_scripts’) function?
- Post title and url not showing on google map marker [closed]
- Including js script at end of header
- contact form 7 javascript and wpcf7_before_send_mail action
- Trigger a function during onload
- Embed Kajabi into WP
- Google AdSense Ad not showing up in WordPress Blog [closed]
- Why is this script not working?
- Astra Mobile Cart Drawer is blank on home page