JQuery :: Getting The Value Of A Specific Value Contained In A <p> Tag?
Aug 24, 2009
I am having difficulty getting the value of a specific value contained in a <p> tag, what is happening is that it retrieves the value of the first <p> tag value and not the one the user clicksWhat I need is to retrieve the value from the <p> tag the user clicked
$(document).ready(function() {
$("p").click(function () {
var prop = $("#property_links").val();
i am thinking of using a xml file as a data base for example , the xml file stores a list of reference numbers which is allocated to a url or a name such as 0123456789 and i have a text box on a webpage and the user types in a reference number and the javascripts reads the xml file to check if its a valid reference number i.e a registered number i am new to working with xml etc.
[Code]....
id like it to read the specific data thats contained within the tag such as 0123456789's tag = JOE
I'm trying to get the width of the elements contained in a div. At the moment that was my best try : $("div.mydiv").children().width(); But all I get is the width of the first child.
What I need is the width of child1 + child2 + child3 etc.... each child might have a different width and they can be a div or an image <img>.
I'm receiving html into a variable from an external source and I'm trying to modify the id of one of the inputs within the html but when I change it, the original html isn't getting updated. an example of what I'm trying to do is :
var sTemp = "<div><input type='hidden' name='test' id='test' /></div>"; $("#test", sTemp).attr("id","newid"); after changing the attribute, sTemp still contains the original 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?
I have an asp application contained within an Iframe. If the browser refreshes, the page within the Iframe reverts back to the login page and the user has to log on again.Is there a way to keep this from happening if a user clicks the refresh button on their browser?
Basically I have an application which generates HTML using VB dll's. This makes the code generated un-changeable as the dll's are not to me modified in any way. What I need to do is get hold of a image element so that I can switch its SRC to dynamically change the image. GetElementById is out as the nearest I can get to it is the <a> tag surrounding the <img> tag, so my question is what's the easiest and most bomb proof method of accessing this element.
How do I use Javascript to loop through all the spreadsheets contained in 1 excel file?
I am now at the stage where I can open the Excel file and find a value on 1 spreadsheet. Is there any way to detect if the workbook has multiple spreadsheets and then loop through all the spreadsheets to find a value?
I am planning on using the maito form with Javascript. I have a form and it is structured in the following fashion: <form> <b>Subject </b> <input type="text" name="subject" size="30"><br> <b>Person 1 <b><input type="checkbox" name="email" value="person1@email.com"><br> <b>Person 2 <b><input type="checkbox" name="email" value="person2@email.com"><br> <b>Person 3 <b><input type="checkbox" name="email" value="person3@email.com"><br> <input type="submit" onclick="submit"> </form>
What I am trying to do with Javascript is that you fill out the subject name and then you select which recipients of email you want to receive the email. So if I select Checkbox 1 and Checkbox 3 then when I click submit, it opens my Outlook and the To is filled in with person1@email.com;person2@email.com. So I guess I would need the javascript to populate and <href mailto: form after checking which names are checked and then populating the mailto with the variable that contains the list of names I chose. Right now we have a clunky method using the mailto but I don't have the option of choosing who it mails to so when I send it, I send the mail to everyone, even those on vacation.
I have a window (it's a modal dialog as well, but let's ignore that for now), where I need to write data into an iframe. Dynamically generated data. This data contains a form, this form is then sent to a server process, which expects it to be latin1 (iso-8859-1). It arrives as UTF-8. I have set the charset both in the container html (which contains the iframes) and the iframe in question to latin1, I once toyed with accept-charset of the form as well, all was ignored. So I started to recreate the experiment step by step.
HTML, meta tag text/html charset=iso-8859-1, FORM directly in it --> data is sent as latin1 Next I put the HTML for the form into its own HTML, put an iframe into the first documented and had its src point to the new HTML. Both the new and the old HTML had charset meta tags. Form was loaded into iframe, sent properly as latin1.
I removed both metatags, we're still sending as latin1. Next I thought it might have something to do with the dynamic nature of the iframe filling. I only assigned the iframe's src at runtime. Still, latin1.
Then I took the final step, and instead of reading an html into the src of the iframe, I wrote the code into the iframe with document.write. Everything LOOKED the same, but the server now receives the form data as UTF-8.
For this experiment I am using IE 5.5 (it is our compatibility base, another browser is not an option unfortunately - I'm a straight firefox man at home), and yes, the content has to be written into the iframe dynamically. I cannot create a temp file that I would load into it, or I would much rather not (it's a rather complex performance issue)
To clarify: Soon as I'm using document.write, all meta tags and or accept-charset (or what it was called) for the form are ignored completely.
I have created a page which pulls search results from various sites using PHP. It displays each result in a row in a table upon running.
I wanted to add a button saying "More information" at which point, a div would appear and load the associated link for that search result within an iframe within the newly appeared div. I've been able to get a div appear and disappear on button click but, I couldn't get it to dynamically load an iframe on click with the associated search results link.
I was trying to develop something where on hover of a paragraph the background colour of a div tag that contained all the content changed correspondingly.So the html is something like this:
Code HTML4Strict: <div id="container"> <p>Change the colour</p> </div>
I did something simple first where the text colour of the paragraph changed on hover of that paragraph. Now that works completely fine. Here is the code:
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?
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.
Im writing client-side javascript and I want to do a server side include. There are many server files but only one will be included. These files contain peoples names and phone numbers. This info is packaged as a line of javascript but I can change that packaging if necessary.
The file name to include is being passed as a url parameter: [url]
I know how to parse the url string and stuff the ID number into a javascript variable.
I set <ICODE> foo = "/people/12345.html" </ICODE> and tried <ICODE><!--#include virtual="${foo}" --> </ICODE> but this did not work.
Is there a way to do this with javascript given that the name of the file I wish to include is contained in a variable? If not, what is the usual way of getting the data in the server file into my client-side javascript?
I am looking to have a link open a closeable window that is contained within a browser window. If you click on the "sizing charts" link on this website, this is exactly what I am looking to do:
[URL]
The window is contained within the current browser window, it can be dragged around, but not outside the parameters of the browser window.
We use for a project the following code for tab navigation. Now the client wants to link directly to a specific tab from outside (for example to tab 3). Is it possible to modify this code with less work or I have to switch to Jquery UI Tabs and build it up again?
/* - TAB SWITCH - */ $(document).ready(function() { $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("aktiv"); //Remove any "active" class $(this).addClass("aktiv"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); });
And in the html: <ul class="tabs"> <li class="aktiv"><a href="#tab1"><span>Tab 1</span></a></li> <li><a href="#tab2"><span>Tab 2</span></a></li> <li><a href="#tab3"><span>Tab 3</span></a></li> <li><a href="#tab4"><span>Tab 4</span></a></li> </ul> <div id="inhalt"> <div id="tab1" class="tab_content text"> .....
So I have a div with id "navigation" which contains an <ul>, and the <ul> has several <li> items.What I want to do is to animate the <li> items as i rollover them.My question is , how can I only animate the current <li> I rollover, because right now when I rollover one, all <li> items animate.