Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,189
Total Posts: 566,916
There are 33 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming :

jQuery Guru's

Thread title: jQuery Guru's
Reply    
    Thread tools Search this thread Display Modes  
01-30-2010, 09:08 PM
#1
v-a-l-o-r is offline v-a-l-o-r
v-a-l-o-r's Avatar
Status: Member
Join date: Jul 2008
Location:
Expertise:
Software:
 
Posts: 100
iTrader: 1 / 100%
 

v-a-l-o-r is on a distinguished road

  Old  jQuery Guru's

Hi everyone. I have a bit of a problem. I was wondering if someone can show me how to find a container (div element) inside a string.

I'm loading a page's HTML and assigning it to a variable. So for example, the string data has the html source code of a web page. Now inside this string, I have a div with an id that I need to find and assign to the variable data.

Can someone please help me here. Javascript is not my thing.

Thanks!

Reply With Quote
02-09-2010, 11:19 AM
#2
metarocket is offline metarocket
Status: I'm new around here
Join date: Feb 2010
Location: Plymouth, United Kingdom
Expertise:
Software:
 
Posts: 12
iTrader: 0 / 0%
 

metarocket is on a distinguished road

  Old

I imagine using a Regexp would be the easiest way. http://www.w3schools.com/jsref/jsref_obj_regexp.asp

Reply With Quote
08-15-2010, 11:20 AM
#3
elitePraetorian is offline elitePraetorian
Status: I'm new around here
Join date: Aug 2010
Location: Sydney
Expertise: Web design and development
Software: Photoshop, Dreamweaver
 
Posts: 5
iTrader: 0 / 0%
 

elitePraetorian is on a distinguished road

Send a message via Skype™ to elitePraetorian

  Old

um just use selectors? :S

http://www.w3schools.com/jquery/jquery_selectors.asp

sorry if i dont understand but what u wanna do is get a certain div out of text well an entire html file can be considered one big string since browsers usually ignore unnecessary whitespace.

Reply With Quote
08-15-2010, 11:35 AM
#4
Immersion is offline Immersion
Status: Senior Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 918
iTrader: 5 / 100%
 

Immersion is on a distinguished road

  Old

$('<div id="someId">This is the string</div>').find("#someId");

Reply With Quote
08-15-2010, 06:48 PM
#5
Jordan is offline Jordan
Jordan's Avatar
Status: #pugs {display: block;}
Join date: Jan 2007
Location: Chicago
Expertise: CSS, HTML, PHP
Software: Sublime Text 2
 
Posts: 1,187
iTrader: 7 / 100%
 

Jordan is on a distinguished road

  Old

elite and Immersion: Original thread date: 01-30-2010, 03:08 PM

Reply With Quote
08-15-2010, 07:18 PM
#6
Gaz is offline Gaz
Gaz's Avatar
Status: Request a custom title
Join date: Apr 2007
Location: UK
Expertise: Code & Programming
Software: Coda, TextMate, Sublime 2
 
Posts: 2,096
iTrader: 26 / 100%
 

Gaz will become famous soon enough Gaz will become famous soon enough

Send a message via Skype™ to Gaz

  Old

Originally Posted by Jordan View Post
elite and Immersion: Original thread date: 01-30-2010, 03:08 PM
Could be useful to someone else, I suppose? :P

Reply With Quote
08-15-2010, 10:29 PM
#7
Immersion is offline Immersion
Status: Senior Member
Join date: Dec 2005
Location:
Expertise:
Software:
 
Posts: 918
iTrader: 5 / 100%
 

Immersion is on a distinguished road

  Old

Originally Posted by Jordan View Post
elite and Immersion: Original thread date: 01-30-2010, 03:08 PM
Lol woaw, really didn't look at the date. Saw the latest comment and assumed it was recent. Anyways, and thats how its done, boom!

Reply With Quote
Reply    


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed