Hot answers tagged

13 votes
Accepted

Can't upload files with IE11 - does not support binary blobs

You should be able to make it work by switching to readAsArrayBuffer and then using the following in your onload callback to build the binary String. var binary = ""; var bytes = new Uint8Array(e....
user avatar
  • 13.3k
10 votes
Accepted

Open jQuery Dialog from Custom Button

Check the following things: 1. Button Behavior Execute JavaScript2. JavaScript: {!REQUIRESCRIPT('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js')} {!REQUIRESCRIPT('//ajax.googleapis....
user avatar
10 votes
Accepted

Jquery not initialised after rerender

You will need to reload the jquery function after reRender .Typically I use oncomplete event of action function or action support and bind back the jquery function again . <apex:page controller="...
user avatar
10 votes
Accepted

$A.enqueueAction is hit, but not executed until another event fires in page (SweetAlerts)

I think this is happening because you are calling the method from outside Aura's normal rendering cycle -hence it works once you force something else to render. Try putting your callback inside this: ...
user avatar
9 votes

How to create collapse and expand functionality between pageblocks in visual force

I assume you are trying to build a so called accordion. As @crmprogdev mentioned I would also recommend to use jquery for this task and not reinvent the weel. You should avoid to go with pure ...
user avatar
  • 33.6k
9 votes
Accepted

jQuery won't execute, even with .noConflict();

Problem is that you have created a variable $j but you have used j$ in the script to access DOM elements. Just change the variable name to j$ and that should start working.
user avatar
  • 4,323
9 votes

How to use apex ids within jquery functions

VF adds to the Ids if not all elements has an id. It will be like jd_0.showmsg So use a Ends With selector as below $("[id$=showmsg]") Did you include jQuery? The following works fine for me: ...
user avatar
  • 53.1k
9 votes

How to run " $('div').clone().appendTo('.wrapper'); " in LWC?

In LWC, we usually do not create dynamic nodes this way. It is idiomatic in LWC to use a repeating template (for:each and for:item) and only change the data that drives the template, rather than clone ...
user avatar
  • 433k
8 votes
Accepted

jQuery & Angular in Salesforce

Yes you can definitely develop UI containing angular/jquery in Salesforce. In fact, that is the current trend. Traditional middleware developers like me who recently moved to salesforce realized that ...
user avatar
  • 1,732
8 votes
Accepted

jQueryUi input[inputIndex].hasOwnProperty is not a function

I can confirm this is reproducible. The root cause of the error is jQueryUI executing window.hasOwnProperty("document"). You can see this by opening up chrome debugger and breaking on all exceptions. ...
user avatar
7 votes
Accepted

Return list of records from Salesforce Object with JavaScript

The easiest way I've found is to make use of the AJAX Toolkit and the sforce.connection.query method (remember to change the actual query to what you're after). <script type="text/javascript"> ...
user avatar
  • 13.3k
7 votes

jQuery NiceScroll not working when Locker Service is active

When locker service is in place, the golden rule is: you cannot access the DOM of the components you do not own Why this is enforced? It is mainly to preserve the component encapsulation, so that ...
user avatar
  • 10.1k
7 votes
Accepted

How do I disable or lock lookup fields on a Visual Force page?

The JQeury doesn't handle the lookup button.. In case it is always disable consider using instead : apx:outputField If it depend on criteria you can add both input & output but show only 1 of ...
user avatar
  • 1,545
7 votes
Accepted

Uncaught ReferenceError: jQuery

By using apex:includeScript, the sisyphusf script loading is moved to the beginning of the page: When specified, this component injects a script reference into the element of the generated HTML ...
user avatar
  • 130k
6 votes
Accepted

How to pass a JavaScript array to Apex controller

Passing an array natively wouldn't be easy, if it is even possible. Personally, I'd convert the array to JSON, then on the controller side, use JSON to turn it back to an array. You could also use ...
user avatar
  • 433k
6 votes
Accepted

What is the best way to pass some value into a modal dialog from a datatable

I usually go ahead and load them into the DOM when I load the page and then pass them on. I use the html5 data elements to store things that aren't going to be displayed but are needed by JavaScript. ...
user avatar
6 votes
Accepted

jQuery not reloading properly after switching to new tab in Lightning Component

It's a timing issue where the first call to setListener happens to run late enough (after your component has rendered to the dom) - the first time only - the second (nth really) time ltng:require has ...
user avatar
  • 9,974
6 votes
Accepted

Using jQuery to add numeric values in Apex:repeat

You've got a few problems here. First, "total" isn't the ID of the repeat element in the traditional HTML sense. I'm pretty sure it doesn't even get rendered into the final HTML, so JavaScript can't ...
user avatar
  • 433k
6 votes
Accepted

Is it possible to call a Lightning Component from a Javascript function?

There is an event named force:navigateToComponent. You can use this event for going to another component. It is currently in the Beta version in the Winter '17 release. Example: var evt = $A.get("e....
user avatar
6 votes
Accepted

jQuery Keyup function not working

You're using JQuery before declaring jQuery.noConflict(); Also, this statement replace the $ variable by jQuery. And finally, as Rahul just said in his answer, Salesforce add a prefix to the ids ...
user avatar
  • 7,218
6 votes

jQuery in VisualForce is not working

Any element that starts with apex: will have a "managed Id", which includes some prefixes like "j_0:j_10:j11:...". Since jQuery basically uses document#querySelectorAll, you need to use the "ends-with"...
user avatar
  • 433k
5 votes
Accepted

Jquery scroll to bottom of a visualforce page on buttonclick

Quick javascript function to do this: window.scrollTo(0,document.body.scrollHeight); where the parameters are the coordinates for x and y, respectively. Documentation of the function: Window....
user avatar
  • 1,669
5 votes
Accepted

Can I return .getAll() in a particular order?

The getAll() method returns a map where the key is the setting name so to order by that: public String planUnitList { get { List<String> names = new List<String>(All_Data__c....
user avatar
  • 130k
5 votes
Accepted

Jquery Modal Popup window in Salesforce is vanishing after it shows for 2 seconds

Perhaps the underlying button submit is causing this; adding event.preventDefault() to your click function should stop that.
user avatar
  • 130k
5 votes

Want to change the height of the home page component dynamically

As soon you a Visualforce page is used, the solution provided by @Bruce will fail and @Faisal is right: it simply won't work becaus of XSS protection mechanisms of the browser and the usage of ...
user avatar
  • 33.6k
5 votes

Page cannot use jQuery Plugin as it's registered with $ from Sidebar component

One hacky work-around would be to look for the instance of jQuery that the plugin is registered with: <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function() { ...
user avatar
  • 130k
5 votes
Accepted

Filter by multiple conditions / drop-downs using DataTables - Table plug-in for jQuery

Yes just create two dropdown. once you int your datatable just add the script var table = table = $('#tableId').DataTable( {}); $('#firstDropdownId').on('change', function () { table....
user avatar
5 votes

How to assign value to a apex variable in visualforce page ,using javascript/jQuery?

You can define actionFunction, it will invoke controller method, and pass parameter from javascript <apex:actionFunction name="jsFunction" action="{!apexMethod}" > <apex:param ...
user avatar
  • 2,603
5 votes
Accepted

Rest API (POST method) with Jquery

Oh Got the solution. I think I need to spend more time with my research before asking question here. Here is the working code. Actually after adding content type in header(also JSON.stringify()). It ...
user avatar
5 votes

JQuery Validation on a Bootstrap Form in Salesforce?

The id attribute of apex:inputText will be used to generate a unique id on the HTML element, but it won't be the actual id. Usually it's something like i0:j0:contentMinutes. In order to get the ...
user avatar
  • 4,543

Only top scored, non community-wiki answers of a minimum length are eligible