Linked Questions
86 questions linked to/from How to use a regular expression in a jQuery selector?
9 votes
4 answers
1k views
jQuery attribute selector: [x=y] or [x=z]
I have the following jQuery selector: $("a[href^='http://'],a[href^='https://']"); Is it possible to change this so that I don't need to specify a[href^= twice? For example, something like: $("a[...
2 votes
3 answers
2k views
Parse classname for number at end?
I have elements. I know for sure they will have a class 'fc-id#' where '#' is a number. I need to somehow get that number. This will always be the first class of the element. Is there some way to ...
0 votes
3 answers
3k views
Find total element within a div with certain id
I have the following script: <div> <p id="example1"></p> <div></div> <p id="example2"></p> <div></div> <p id="example3"></p>...
1 vote
4 answers
584 views
Select all divs with specified string
$("#slide") code formating i've got something like this, i want my function to select all id's starting from slide, slide1, slide2 etc. In bash there is slide*, which does that job, is there anything ...
2 votes
2 answers
2k views
jquery find a selector whose id contains a string using regex
I want to match input fields that match the following pattern: a_profile_contact_attributes_addresses_attributes_0_address b_store_contact_attributes_addresses_attributes_3_address ...
1 vote
5 answers
2k views
How to get elements of similar name? jQuery
<input name="Indian_Karnataka_Bangalore" value="Bangalore" /> <input name="Indian_Andhra_Hyderabad" value="Hyderabad" /> <input name="Indian_Kerala_Trivandrum" value="Trivandrum" /> &...
-2 votes
2 answers
3k views
jQuery get ID attribute using regex
<div class="A1"> <div id="child1">A1-1</div> <div id="child2">A1-2</div> <div id="child3">A1-3</div> <div id="child4">A1-4</div> ...
2 votes
2 answers
2k views
passing multiple variables to function in order to add/remove class Jquery/Javascript
I'm trying to first clear the class of all options and then add a class to the option with the corresponding letter. Here's my function: function setAnswer(b, c){ $('#'+b+' .option')....
3 votes
1 answer
2k views
Css Selector for inputs which name contains two words?
It is possibile to use this selector $( "input[name~='man']" ) to identify any input in page which name contains the word 'man' but if i need to select, instead of a single word pattern i.e. 'man', a ...
2 votes
8 answers
876 views
Matching text in HTML without contents of the tag
I am looking for a regex for Javascript to search for text ("span" for example) in HTML. Example: <div>Lorem span Ipsum dor<a href="blabla">lablala</a> dsad <...
5 votes
2 answers
2k views
select HTML text element with regex?
I want to look for © in an HTML document, and basically get the entity the copyright is attributed to. The copyright line shows up a couple of different ways: <p class="bg-copy">&...
0 votes
2 answers
1k views
How can I target all anchor tags that have an fragment url reference?
Say in my html I have the following anchor tags: <a href="#fragment1"> link 1 </a> <a href="http://someExternalResource.com"> link 2 </a> <a href="#fragment2"> ...
0 votes
3 answers
2k views
How to split the selected value from dropdownlist and use it as a selector in jquery
If my title seems stupid, forgive me. I'm a newbie in jQuery and I don't know to explain my problem using the correct jQuery terms. So I asked this question a while ago and got the perfect answer. ...
2 votes
4 answers
870 views
Apply class to every div with certain id if the id ends with a even number using jquery
I would like to apply a class to each div with a certain id if that id ends with a even number. Also i want to apply a different class to the ones that end with a odd number. Ideally it would be great ...
0 votes
2 answers
664 views
match dates with jquery
I want to match these tags: <div>03-24-2010</div> <div>04-23-2011</div> With jquery: ("div:contains([0-9]{2}-[0-9]{2}-[0-9]{4})") What do I need to do to the regular ...