JQuery :: Selecting Specific Part Of String?
Mar 17, 2011
I have:
<div class="date">21-Mar-11</div>
I would like to select only the 21 and then only the "Mar" and replace the content of the div with "Mar 21," or something along those lines. The output is not the problem. I need selecting specific parts of the string. So I want to learn more about selecting specific parts of strings.
View 1 Replies
ADVERTISEMENT
Jun 10, 2011
I'm trying to grab a specific part of a string of text and am wondering how to do it (or if it is possible to do it) with a jQuery selector.Is there any way to get that specific part of the link?
View 2 Replies
View Related
Jul 23, 2005
Scenario: you enter "foo bar" into a text field... Is it possible
through javascript to select/highlight just "foo"?
formObject.select()
selects all. I need to select only part of the string.
View 5 Replies
View Related
Nov 12, 2011
You can't select the 'text' part of an 'a' element with css, e.g. in the statement <a>some text </a> you can't use a css attribute selector a[text = "some text"]{} to style the 'a' element. You can select all named attributes such as HREF, TITLE, etc. Does jquery's .attrib map strictly to the css usage or is there some way I can match on that part of an 'a' element?
I need this because a menu list I'm working with doesn't by default require a TITLE element so I can't assume I can match on this attribute.
View 6 Replies
View Related
Apr 9, 2011
I intend to have this code below generated dynamically (being able to have from 12 to 40 rows). (created from C# code)
<tr>
<td align="center">
<h2>
01</h2>
[Code].....
Can this jQuery function be created so I can add the function to "#<%= chbNuevoJugXX.ClientID %>" instead of "#<%= chbNuevoJug01.ClientID %>" and then use the XX to how hide the corresponding row?
View 3 Replies
View Related
Apr 21, 2010
I have the following scenario(well the structure is the same):
<fieldset id="fs"><p><select id="sl" runat="server" /></p></fieldset>
The name of the fieldset is constant but the name of the select is generated via asp.net thus i do not know the final id on that element. I can call on the select by using $("[id$='sl']").change() which works. But its a bad solution because I need to be sure that I only trigger the element under the fieldset "fs".
$("#fs").children().change()
Works as well but i obviously I am looking for a way to target only that select element under only that fieldset.
View 2 Replies
View Related
Oct 22, 2010
I am trying to create a Google Translate widget on my webpage, with just one language pair, Latin to English. Unfortunately the Google Translate AJAX API only supports a subset of all languages available, and Latin is not included. However, Latin IS included on the Google Translate website. Apparently languages that are in beta are available there, via a different server, while only fully released languages are available via the AJAX Translate API.a) I wrote a script that generated the XMLHttpRequest() call to the server the Google Translate website uses, but it always returned a '0' status code. I have since found out that this is normal, as these kinds of calls can only be made between pages on the same server.b) I then wrote a script that created a popup, and used the baseURL+params for the URL, , and this produced a pop-up window containing the translation result. However, as that page came from a different server to the server containing the script, I could not access the results on it. The code for that is here:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
[code]....
View 3 Replies
View Related
Apr 12, 2011
How can I split a string like this:
IE, Firefox, Opera, Chrome, Safari
I want the string to be splitted after each ,
Then I want that each splitted part is placed in a variable, preferable in an array, so I can loop through the array with an foreach or something.
View 3 Replies
View Related
Jan 24, 2010
I am trying to do is load new content into a form without resetting the form. I have about 10 checkboxes, once 4 are selected I would like to reload a div in the page to insert four corresponding textareas with the same id as the checkboxes. So for example the checkboxes:
Code:
<div id="page_select">
<input type="checkbox" name="option1" id="option1" value="Home" /> Home
<input type="checkbox" name="option2" id="option2" value="About" /> About</div>
There would be about 10 after 4 are selected than four divs with textareas are loaded onto the page - These textareas have the same id in order for the right ones to load. If your wondering why not just hide the textareas and show when then have been selected by the checkboxes, its because they have a wysiwyg editor attach so it would start to load slow after I add say 10-20 different textareas.
Would this work:
Code:
$(document).ready(function() {
$('#reload_1').click(function() {
//var names = [];
var myScripts = new Array(4)
$('#page_select input:checked').each(function() {
names.push(this).attr("id");
});
$('#content_div').load('external_content.php.html # . + '. myScripts[0]);
$('#content_div').load('external_content.php.html # . + '. myScripts[1]);
$('#content_div').load('external_content.php.html # . + '. myScripts[2]);
$('#content_div').load('external_content.php.html # . + '. myScripts[3]);
If I had all the divs and textareas in external_page.php and load only the ones needed.
View 4 Replies
View Related
Aug 3, 2011
I am current building an information database for the company I work at...basically just a place for employees to get information and answers from. It is all hosted on a local server and I can only use javascript, html, and css. I've got everything made there is just one thing i want to add to it. Basically an "alerts and updates" page that only some people can edit without having to know html so if im not there they can post important updates. No computers have access to the internet so I did try some rich text editors but none of them worked. The layout I'm going for is kind of like this.
Alerts and Updates
Click on links to show updates: update 1 * update 2 * update 3 * update 4
Stuff goes in the update
[edit button]
You click edit it prompts you to login, bring up something to edit the text in that specific update you hit submit and it changes the info that was on there. The update links are linked to a script I wrote that just display the info below so when the page loads you see whats in update 1 then you click update and it changes the content to the next one.
View 1 Replies
View Related
Aug 7, 2009
I'm trying to add a class to a <li> where the href within it contains a string. I can apply the class to the anchor without a problem, but I can't seem to select the parent. Is an anchor a child? <li><a href="random.xls">Random Stuff</a></li>
In this case, since the href contains .xls, I'd like to be able to add a class to it. I've tried a variety of things, most recently this, but no luck: $('li has(a[href$=".xls"])').addClass('excel');
View 1 Replies
View Related
Jul 8, 2010
how can i select elements from a HTML string. i have used .get() to load data and i want to search for HTML elements within that data/string
$.get(nextHref, function(data) {
alert(data); // OK
// i tried
alert($(data).find("#posts").html()); // returns null
[Code]....
View 5 Replies
View Related
May 3, 2010
I've been trying to select the rows of a table inside a specific div, but I'm having a tough time making it work.
Code:
function add_row_hover(elementID) {
var contentArea = document.getElementById(elementID);
var rows = contentArea.getElementByTagName('tr');
[code].....
I figure I can target a specific div, then add specific information to any table row inside of it. This doesn't seem to work though.
View 1 Replies
View Related
Sep 16, 2011
JS isn't my usual language, but I'm venturing out to write a Chrome extension. This extension basically just injects a script on a page, so it behaves just like any other JS.Anyway, the script finds specific URLs on a specific page, and changes them slightly. I'm using regex to find these URLs. I've got one working, but I need another, and I can't figure it out.The first is this:Also, my skills with regex are miserable, so if you know of any way to make this better, I'm all ears. This matches URLs like this:Now I'm trying to match URLs like this:[URL]If you know how to modify the original regex so that it'll match the second kind of URL (but not the first)
View 6 Replies
View Related
May 20, 2011
I have a bit of a problem and as my javascript is a rather poor I'm struggling to come up with a solution. Basically I need to split the variable "#country" into two parts and call the second half as the "this" value for '#int-dc'. Using '+' as the start point end ending at the end of the string.
For instance 'this' returns 12+44 I want to split it to "12" and "+44" the latter (+44) replacing 'this' in the code below.
$(function() {
$("#country").change(function() {
$("#int-dc").val
($(this).val());
});
});
View 6 Replies
View Related
Jun 15, 2011
I need to extract a particular part of a string:
var str=(document.images('flag').src);
<img id="flag" src="../../../../img/ip/041-080/049p.png">
I only want the "041-080/049" part.
It needs to be read from the right, not the left because the preceding left part will vary in length.
View 6 Replies
View Related
May 26, 2009
I have this code:
function getLocation() {
var siteurl = document.location.href;
document.write(siteurl);
}
I want to extract from string etc. [URL] this part:"/page1/page2".How I can do it?
View 4 Replies
View Related
Feb 17, 2006
i have an expression, say "5*7 + temp". i have an algorithm that finds out that "temp" is undefined in that expression. now i need to change the color or background color of "temp" to show that it is undefined.
i know which position the "temp" is, but i dont know how to change the color of it.
View 1 Replies
View Related
Aug 22, 2011
Is it possible to trigger an event ONLY IF a specific string is typed but not in a form field?
i.e.$('html').keyup(function(){
if(wordTyped == '12345'){alert('Woohoo!');}
});
The reason I ask, is I have a barcode scanner and I want to be able to trigger a submit button next to the matching product on scanning the barcode. So basically, the user can open the page (and may have clicked on some elements already) then scan a product which will input a 13 digit number and the submit button with that matching id will be clicked/submitted. This is easy enough to do if I use a text input, but I a) don't want the user to have to click in the text box first. b) don't want the user to have to delete the text box to scan the next product.
Perhaps it can be done somehow with a hidden field that automatically resets on each scan?!?
The scanner works just like a keyboard as I have used it to filter products with keyup() in a text field...so it does actually activate keyup(). So it should have exactly the same affect if you type the numbers manually.
View 3 Replies
View Related
Apr 15, 2011
I have a script that is supposed to: Make sure that the user selects a performance from a select field Make sure that the user hasn't selected a performance that contains the string "SOLD OUT" in its value Here is the code I am using:
$(document).ready(function() {
$('#paypal-purchase').submit(function() {
alert($('#paypal-purchase-date').val());
if($('#paypal-purchase-date').val() == 'Select Performance Date') {
[Code]......
[URL]
View 2 Replies
View Related
Mar 30, 2010
I'm curious if there is a possibility of being able to search the whole document for a specific string using replace("that", "this") for example to find any reference to "this" and replace it with "that" and then show the modified content.
View 5 Replies
View Related
Aug 15, 2011
I have a string and I can return say, the fourth letter with output[3], but i can't assign a value to it for some reason[code]...
View 9 Replies
View Related
Feb 2, 2010
I have some long html text like this:
HTML Code:
some text [URL].. continue of the text How can I add some content before and after the matching statement. I meant for example how can I change the above text into:
HTML Code:
some text <a href="http://www.example.com">http://www.example.com</a> continue of the text
View 1 Replies
View Related
Mar 10, 2010
<div class="box top"></div>
<div class="box main">
<div class="box header">
<div class="badge"><ul><li class="active"><span>60</span></li></ul></div>
[Code]....
What is happening is $(this) is no longer based on .expand being the (this) that is clicked.
like if i have a button SOMEWHERE randomly on the page with this
<div onclick="Minimize('_alerts');">Click Here</div> this will minimize alerts but because the (this) in minimize function doesn't actually point to the right button that I want to add a class to.
Is there a way to modify the minimize function so that it finds the <div id="mytoggle"><ul> <li class="expand boxminimize" rel="_alerts"> using the rel toggle, and then changes the class of the li from expand boxminimize to boxexpanded??
just like the .expand click function I posted on the top of the post that works?
View 1 Replies
View Related
Oct 6, 2009
Another thing that has been driving me crazy is that css positioning is handled differently by different browsers. JS is not my area, but I can do a lot with CSS, and I do, but cross browser compatibility is killing me.
I can use an IF IE statement and only IE runs that segment of code, but I haven't been able to figure out out how to make ONLY firefox or ONLY opera or safari enact an encapsulated segment of code. The same type of IF statement doesn't work for them.
Is there a single method using JS that works for all browsers?
View 8 Replies
View Related
Apr 19, 2010
I know this code works just fine:
function result(){
var result = document.getElementById('resss').innerHTML;
}
But what I actually want is to import data from a table of an external website. E.g. I want to get the innerHTML of a specific cell in column 3 and row 2 of a specific site.
View 1 Replies
View Related