Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How to find jquery get all elements id starts with or ends with in visual force?

Asked by Aashna Saito Sep 22, 2022 2.3K views 1 answer
Share

About this question

I am trying to search all input elements that start with a particular set of characters such as 'idAcc' where my VF page has two input fields with id = idAccFN and id= idAccLN respectively.


 
 

I'm using the below JQuery syntax but that's working partially ... Explained in the comments below .. Kindly help.


 var j$ = jQuery.noConflict();
 j$(document).ready(function(){
    jQuery( 'input[id$=Name]' ).val('Foo');  // ID ending with Name working 
    jQuery( 'input[id^=idAcc]' ).val('Apu')  //Id starting with idAcc not working 
});

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.