[jQuery] how can we set script/noscript tag html ?

2009-01-16 Thread cc96ai

we can get the .html() in script/noscript
but once we want to write it back, we got error
e.g.
$(script).html(var a=123);

Unexecpeted call to method or property access


[jQuery] html() function remove attribute double quote in IE

2009-01-13 Thread cc96ai

alert( $(content).html() );
-
html code:
div id=content
a id=link href=http://www.google.ca; target=_newtest link/a
a id=link2 href=http://www.google.ca; target=_newtest link2/a
/div
-
it will return in IE6
A id=link href=http://www.google.ca; target=_newtest link/A A
id=link2 href=http://www.google.ca; target=_newtest link2/A

-
can we get the html with double quote around the html attribute ?


[jQuery] Re: strip out textarea 's HTML attribute

2008-11-18 Thread cc96ai

I still get the popup window, if the textarea contains javascript
popup
it seems the following code is still executing.
var code = $(div/).html($(#content).val());


div id=raw/div
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_new border=2test
link/a
img src=images/test.jpg border=1 vspace=2 alt=test
script
alert(popup);
/script
/textarea

On Nov 18, 7:49 am, Eric Martin [EMAIL PROTECTED] wrote:
 I think this should do what you want:

 var code = $(div/).html($(#content).val());
 var links = $(a, code);
 var images = $(img, code);

 links.each(function (i, lnk) {
         $(lnk).removeAttr(target);});

 images.each(function (i, img) {
         $(img).removeAttr(border);

 });

 var clean = code.html();

 On Nov 17, 6:17 pm, Richard D. Worth [EMAIL PROTECTED] wrote:

  As shown earlier by Hector. Here's another example:

  var foo = $(div/div); // create an empty div element
  foo.html(strongHello/strong); // set the html
  var html = foo.html(); // get the html

  It's just in memory, all disconnected from the DOM, as it was never appended
  to the body or any other element in the document. You can also do fun things
  like

  var strong = $(strong, foo); // find strong elements within the context of
  the (in this case) disconnected DOM Element foo, instead of the default
  context, the current document

  - Richard

  On Mon, Nov 17, 2008 at 6:27 PM,cc96ai[EMAIL PROTECTED] wrote:

   if div foo is outside the DOM, how could we use jQuery to assign the
   HTML into it ? and retrieve it back ?

   On Nov 17, 1:51 pm, Hector Virgen [EMAIL PROTECTED] wrote:
The div will only be part of the body if you append it to the body.
var div = document.createElement('div'); // not part of the dom yet
div.setAttribute('id', 'foo'); // set an id, but it's still not part of
   the
dom
document.body.appendChild(div); // now the div is part of the dom

But I'm not sure how script tags are handled prior to dom insertion.

-Hector

On Mon, Nov 17, 2008 at 1:45 PM,cc96ai[EMAIL PROTECTED]
   wrote:

 how could I create the DIV outside the DOM ?
 if I create a div inside the body,  it is part of the DOM, isn't
 it ?

 On Nov 17, 12:32 pm, Hector Virgen [EMAIL PROTECTED] wrote:
  Will javascript be executed by jQuery#html() if the container is not
   part
 of
  the dom?
  -Hector

  On Mon, Nov 17, 2008 at 12:21 PM,cc96ai[EMAIL PROTECTED]
 wrote:

   That is my original design, however if the textarea contains the
   javascript, it will execute the Javascript in div as well.

   in the following example, the popup will come out when we try to
   populate the textarea content into div.
   that's why I am looking other way to parse the content.
   e.g.
   textarea cols=50 rows=5 id=content
   a id=link href=http://www.google.ca; target=_new
   border=2test
   link/a
   img src=images/test.jpg border=1 vspace=2 alt=test
   script
   alert(popup);
   /script
   /textarea

   Thanks,

   On Nov 17, 12:01 pm, Hector Virgen [EMAIL PROTECTED] wrote:
You can try assigning the value of the textarea to a hidden div.
   Then
   you'll
have access to jQuery's functions on the HTML:
var html = $('#content').val();
var div = $('div /').css({display: 'none'});
div.html(html);
div.find('a[target]').removeAttr('target');

Then replace the textarea with the html contents of the div:

var filtered = div.html();
$(#content).val(filtered);

-Hector

On Mon, Nov 17, 2008 at 11:22 AM,cc96ai
   [EMAIL PROTECTED]
   wrote:

 If we do the replace , it will replace all the tag's border 
 target.

 is there anyway it can replace on tag level  ?

 On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED] wrote:
  If you just want the string value, how about:

  var content = $(#content).val();
  content = content.replace(/
   target=(\'|\)_(new|blank)(\'|\)/,
 );
  content = content.replace(/ border=(\'|\)\d+(\'|\)/, );

  -Eric

  On Nov 17, 10:18 am,cc96ai[EMAIL PROTECTED]
   wrote:

   I have a text area in the following
   textarea cols=50 rows=5 id=content
   a id=link href=http://www.google.ca;
   target=_newtest
   link/a
   img src=images/test.jpg border=1 vspace=2
   alt=test
   /textarea

   and I would like to strip out the hyperlink target, and
   image
   border,
   and get the string of the HTML,
   any idea on it?

   I try the following, but it only remove the hyperlink in
   the
 page,
   not
   the hyperlink in textarea.
           $(a).removeAttr(target);

   Can I load the textarea 's content in jquery, then do the
 select/
   remove the attribute and return as string

[jQuery] Re: strip out textarea 's HTML attribute

2008-11-18 Thread cc96ai

Thanks it works fine,

Can I know what is the different between

var code = $(div/).html($(#content).val());
and
var code = $(div + $(#content).val() + /div);



On Nov 18, 10:21 am, Richard D. Worth [EMAIL PROTECTED] wrote:
 change

 var code = $(div/).html($(#content).val());

 to

 var code = $(div + $(#content).val() + /div);

 - Richard

 On Tue, Nov 18, 2008 at 1:14 PM, cc96ai [EMAIL PROTECTED] wrote:

  I still get the popup window, if the textarea contains javascript
  popup
  it seems the following code is still executing.
  var code = $(div/).html($(#content).val());

  div id=raw/div
  textarea cols=50 rows=5 id=content
  a id=link href=http://www.google.ca; target=_new border=2test
  link/a
  img src=images/test.jpg border=1 vspace=2 alt=test
  script
  alert(popup);
  /script
  /textarea

  On Nov 18, 7:49 am, Eric Martin [EMAIL PROTECTED] wrote:
   I think this should do what you want:

   var code = $(div/).html($(#content).val());
   var links = $(a, code);
   var images = $(img, code);

   links.each(function (i, lnk) {
           $(lnk).removeAttr(target);});

   images.each(function (i, img) {
           $(img).removeAttr(border);

   });

   var clean = code.html();

   On Nov 17, 6:17 pm, Richard D. Worth [EMAIL PROTECTED] wrote:

As shown earlier by Hector. Here's another example:

var foo = $(div/div); // create an empty div element
foo.html(strongHello/strong); // set the html
var html = foo.html(); // get the html

It's just in memory, all disconnected from the DOM, as it was never
  appended
to the body or any other element in the document. You can also do fun
  things
like

var strong = $(strong, foo); // find strong elements within the
  context of
the (in this case) disconnected DOM Element foo, instead of the default
context, the current document

- Richard

On Mon, Nov 17, 2008 at 6:27 PM,cc96ai[EMAIL PROTECTED]
  wrote:

 if div foo is outside the DOM, how could we use jQuery to assign the
 HTML into it ? and retrieve it back ?

 On Nov 17, 1:51 pm, Hector Virgen [EMAIL PROTECTED] wrote:
  The div will only be part of the body if you append it to the body.
  var div = document.createElement('div'); // not part of the dom yet
  div.setAttribute('id', 'foo'); // set an id, but it's still not
  part of
 the
  dom
  document.body.appendChild(div); // now the div is part of the dom

  But I'm not sure how script tags are handled prior to dom
  insertion.

  -Hector

  On Mon, Nov 17, 2008 at 1:45 PM,cc96ai[EMAIL PROTECTED]
 wrote:

   how could I create the DIV outside the DOM ?
   if I create a div inside the body,  it is part of the DOM,
  isn't
   it ?

   On Nov 17, 12:32 pm, Hector Virgen [EMAIL PROTECTED] wrote:
Will javascript be executed by jQuery#html() if the container
  is not
 part
   of
the dom?
-Hector

On Mon, Nov 17, 2008 at 12:21 PM,cc96ai
  [EMAIL PROTECTED]
   wrote:

 That is my original design, however if the textarea contains
  the
 javascript, it will execute the Javascript in div as well.

 in the following example, the popup will come out when we try
  to
 populate the textarea content into div.
 that's why I am looking other way to parse the content.
 e.g.
 textarea cols=50 rows=5 id=content
 a id=link href=http://www.google.ca; target=_new
 border=2test
 link/a
 img src=images/test.jpg border=1 vspace=2 alt=test
 script
 alert(popup);
 /script
 /textarea

 Thanks,

 On Nov 17, 12:01 pm, Hector Virgen [EMAIL PROTECTED]
  wrote:
  You can try assigning the value of the textarea to a hidden
  div.
 Then
 you'll
  have access to jQuery's functions on the HTML:
  var html = $('#content').val();
  var div = $('div /').css({display: 'none'});
  div.html(html);
  div.find('a[target]').removeAttr('target');

  Then replace the textarea with the html contents of the
  div:

  var filtered = div.html();
  $(#content).val(filtered);

  -Hector

  On Mon, Nov 17, 2008 at 11:22 AM,cc96ai
 [EMAIL PROTECTED]
 wrote:

   If we do the replace , it will replace all the tag's
  border 
   target.

   is there anyway it can replace on tag level  ?

   On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED]
  wrote:
If you just want the string value, how about:

var content = $(#content).val();
content = content.replace(/
 target=(\'|\)_(new|blank)(\'|\)/,
   );
content = content.replace(/ border=(\'|\)\d+(\'|\)/,
  );

-Eric

On Nov 17, 10:18 am,cc96ai[EMAIL PROTECTED]
 wrote:

 I have a text area in the following
 textarea cols=50 rows=5 id

[jQuery] strip out textarea 's HTML attribute

2008-11-17 Thread cc96ai

I have a text area in the following
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_newtest link/a
img src=images/test.jpg border=1 vspace=2 alt=test
/textarea

and I would like to strip out the hyperlink target, and image border,
and get the string of the HTML,
any idea on it?

I try the following, but it only remove the hyperlink in the page, not
the hyperlink in textarea.
$(a).removeAttr(target);

Can I load the textarea 's content in jquery, then do the select/
remove the attribute and return as string?

Thanks


[jQuery] Re: strip out textarea 's HTML attribute

2008-11-17 Thread cc96ai

If we do the replace , it will replace all the tag's border  target.

is there anyway it can replace on tag level  ?

On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED] wrote:
 If you just want the string value, how about:

 var content = $(#content).val();
 content = content.replace(/ target=(\'|\)_(new|blank)(\'|\)/, );
 content = content.replace(/ border=(\'|\)\d+(\'|\)/, );

 -Eric

 On Nov 17, 10:18 am, cc96ai [EMAIL PROTECTED] wrote:

  I have a text area in the following
  textarea cols=50 rows=5 id=content
  a id=link href=http://www.google.ca; target=_newtest link/a
  img src=images/test.jpg border=1 vspace=2 alt=test
  /textarea

  and I would like to strip out the hyperlink target, and image border,
  and get the string of the HTML,
  any idea on it?

  I try the following, but it only remove the hyperlink in the page, not
  the hyperlink in textarea.
          $(a).removeAttr(target);

  Can I load the textarea 's content in jquery, then do the select/
  remove the attribute and return as string?

  Thanks


[jQuery] Re: strip out textarea 's HTML attribute

2008-11-17 Thread cc96ai

That is my original design, however if the textarea contains the
javascript, it will execute the Javascript in div as well.

in the following example, the popup will come out when we try to
populate the textarea content into div.
that's why I am looking other way to parse the content.
e.g.
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_new border=2test
link/a
img src=images/test.jpg border=1 vspace=2 alt=test
script
alert(popup);
/script
/textarea

Thanks,

On Nov 17, 12:01 pm, Hector Virgen [EMAIL PROTECTED] wrote:
 You can try assigning the value of the textarea to a hidden div. Then you'll
 have access to jQuery's functions on the HTML:
 var html = $('#content').val();
 var div = $('div /').css({display: 'none'});
 div.html(html);
 div.find('a[target]').removeAttr('target');

 Then replace the textarea with the html contents of the div:

 var filtered = div.html();
 $(#content).val(filtered);

 -Hector

 On Mon, Nov 17, 2008 at 11:22 AM, cc96ai [EMAIL PROTECTED] wrote:

  If we do the replace , it will replace all the tag's border  target.

  is there anyway it can replace on tag level  ?

  On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED] wrote:
   If you just want the string value, how about:

   var content = $(#content).val();
   content = content.replace(/ target=(\'|\)_(new|blank)(\'|\)/, );
   content = content.replace(/ border=(\'|\)\d+(\'|\)/, );

   -Eric

   On Nov 17, 10:18 am, cc96ai [EMAIL PROTECTED] wrote:

I have a text area in the following
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_newtest link/a
img src=images/test.jpg border=1 vspace=2 alt=test
/textarea

and I would like to strip out the hyperlink target, and image border,
and get the string of the HTML,
any idea on it?

I try the following, but it only remove the hyperlink in the page, not
the hyperlink in textarea.
        $(a).removeAttr(target);

Can I load the textarea 's content in jquery, then do the select/
remove the attribute and return as string?

Thanks


[jQuery] Re: strip out textarea 's HTML attribute

2008-11-17 Thread cc96ai

how could I create the DIV outside the DOM ?
if I create a div inside the body,  it is part of the DOM, isn't
it ?


On Nov 17, 12:32 pm, Hector Virgen [EMAIL PROTECTED] wrote:
 Will javascript be executed by jQuery#html() if the container is not part of
 the dom?
 -Hector

 On Mon, Nov 17, 2008 at 12:21 PM, cc96ai [EMAIL PROTECTED] wrote:

  That is my original design, however if the textarea contains the
  javascript, it will execute the Javascript in div as well.

  in the following example, the popup will come out when we try to
  populate the textarea content into div.
  that's why I am looking other way to parse the content.
  e.g.
  textarea cols=50 rows=5 id=content
  a id=link href=http://www.google.ca; target=_new border=2test
  link/a
  img src=images/test.jpg border=1 vspace=2 alt=test
  script
  alert(popup);
  /script
  /textarea

  Thanks,

  On Nov 17, 12:01 pm, Hector Virgen [EMAIL PROTECTED] wrote:
   You can try assigning the value of the textarea to a hidden div. Then
  you'll
   have access to jQuery's functions on the HTML:
   var html = $('#content').val();
   var div = $('div /').css({display: 'none'});
   div.html(html);
   div.find('a[target]').removeAttr('target');

   Then replace the textarea with the html contents of the div:

   var filtered = div.html();
   $(#content).val(filtered);

   -Hector

   On Mon, Nov 17, 2008 at 11:22 AM, cc96ai [EMAIL PROTECTED]
  wrote:

If we do the replace , it will replace all the tag's border  target.

is there anyway it can replace on tag level  ?

On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED] wrote:
 If you just want the string value, how about:

 var content = $(#content).val();
 content = content.replace(/ target=(\'|\)_(new|blank)(\'|\)/, );
 content = content.replace(/ border=(\'|\)\d+(\'|\)/, );

 -Eric

 On Nov 17, 10:18 am, cc96ai [EMAIL PROTECTED] wrote:

  I have a text area in the following
  textarea cols=50 rows=5 id=content
  a id=link href=http://www.google.ca; target=_newtest
  link/a
  img src=images/test.jpg border=1 vspace=2 alt=test
  /textarea

  and I would like to strip out the hyperlink target, and image
  border,
  and get the string of the HTML,
  any idea on it?

  I try the following, but it only remove the hyperlink in the page,
  not
  the hyperlink in textarea.
          $(a).removeAttr(target);

  Can I load the textarea 's content in jquery, then do the select/
  remove the attribute and return as string?

  Thanks


[jQuery] Re: strip out textarea 's HTML attribute

2008-11-17 Thread cc96ai

if div foo is outside the DOM, how could we use jQuery to assign the
HTML into it ? and retrieve it back ?

On Nov 17, 1:51 pm, Hector Virgen [EMAIL PROTECTED] wrote:
 The div will only be part of the body if you append it to the body.
 var div = document.createElement('div'); // not part of the dom yet
 div.setAttribute('id', 'foo'); // set an id, but it's still not part of the
 dom
 document.body.appendChild(div); // now the div is part of the dom

 But I'm not sure how script tags are handled prior to dom insertion.

 -Hector

 On Mon, Nov 17, 2008 at 1:45 PM, cc96ai [EMAIL PROTECTED] wrote:

  how could I create the DIV outside the DOM ?
  if I create a div inside the body,  it is part of the DOM, isn't
  it ?

  On Nov 17, 12:32 pm, Hector Virgen [EMAIL PROTECTED] wrote:
   Will javascript be executed by jQuery#html() if the container is not part
  of
   the dom?
   -Hector

   On Mon, Nov 17, 2008 at 12:21 PM, cc96ai [EMAIL PROTECTED]
  wrote:

That is my original design, however if the textarea contains the
javascript, it will execute the Javascript in div as well.

in the following example, the popup will come out when we try to
populate the textarea content into div.
that's why I am looking other way to parse the content.
e.g.
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_new border=2test
link/a
img src=images/test.jpg border=1 vspace=2 alt=test
script
alert(popup);
/script
/textarea

Thanks,

On Nov 17, 12:01 pm, Hector Virgen [EMAIL PROTECTED] wrote:
 You can try assigning the value of the textarea to a hidden div. Then
you'll
 have access to jQuery's functions on the HTML:
 var html = $('#content').val();
 var div = $('div /').css({display: 'none'});
 div.html(html);
 div.find('a[target]').removeAttr('target');

 Then replace the textarea with the html contents of the div:

 var filtered = div.html();
 $(#content).val(filtered);

 -Hector

 On Mon, Nov 17, 2008 at 11:22 AM, cc96ai [EMAIL PROTECTED]
wrote:

  If we do the replace , it will replace all the tag's border 
  target.

  is there anyway it can replace on tag level  ?

  On Nov 17, 10:34 am, Eric Martin [EMAIL PROTECTED] wrote:
   If you just want the string value, how about:

   var content = $(#content).val();
   content = content.replace(/ target=(\'|\)_(new|blank)(\'|\)/,
  );
   content = content.replace(/ border=(\'|\)\d+(\'|\)/, );

   -Eric

   On Nov 17, 10:18 am, cc96ai [EMAIL PROTECTED] wrote:

I have a text area in the following
textarea cols=50 rows=5 id=content
a id=link href=http://www.google.ca; target=_newtest
link/a
img src=images/test.jpg border=1 vspace=2 alt=test
/textarea

and I would like to strip out the hyperlink target, and image
border,
and get the string of the HTML,
any idea on it?

I try the following, but it only remove the hyperlink in the
  page,
not
the hyperlink in textarea.
        $(a).removeAttr(target);

Can I load the textarea 's content in jquery, then do the
  select/
remove the attribute and return as string?

Thanks


[jQuery] how to output element in string

2008-11-10 Thread cc96ai

a id=link href=/test.html target=_newmy link/a

after remove the target attribute
$(#link).removeAttr(target);

I want to get the string is
a id=link href=/test.html my link/a

but how could I ?
I don't think jquery have toString() function,
any idea ?



[jQuery] get onclick value

2008-10-15 Thread cc96ai

a id=link1 onclick=target=_self href=http://test.com/;link/a

alert( $(#link1).attr(onclick) );

expect will be target=_self

but the result is

function anonymous()
{
target=_self
}

any idea how could I only get target=_self back


[jQuery] product grid plugin

2008-09-23 Thread cc96ai

does jquery have any plugin like magento product grid ?
http://demo.magentocommerce.com/bed-and-bath/living-room


[jQuery] Re: put image on top of another image

2008-09-18 Thread cc96ai

it won't work in IE 6.

On Sep 9, 2:42 pm, Andy Matthews [EMAIL PROTECTED] wrote:
 You don't need jQuery for this. It can be done with CSS. Here's a link that
 you can inspect to see what I'm talking about:

 http://www.commadelimited.com/code/overlapimages/

 andy

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On

 Behalf Of cc96ai
 Sent: Tuesday, September 09, 2008 3:34 PM
 To: jQuery (English)
 Subject: [jQuery] put image on top of another image

 I m new on jquery,
 I am not can jquery can do or not
 I want to put a image on top of other image, e.g. we have a product image,
 we want to put a sign of sold or hot buy image on top , any idea how
 could I do it in jquery ?


[jQuery] pagination sample ?

2008-09-12 Thread cc96ai

Does anyone use pagination plugin
http://plugins.jquery.com/project/pagination

is there any sample for calling ajax  ? how could we apply it ?
1) we set the number record in pagination, if that's ajax dynamic
return, we don't know how many will be, how could we resolve it ?


function pageselectCallback(page_id, jq){
$('#Searchresult').text(Showing search results +
((page_id*10)+1)+-+((page_id*10)+10));
   }

$(document).ready(function(){
// Create pagination element
$(#Pagination).pagination(300, {
num_edge_entries: 2,
num_display_entries: 8,
callback: pageselectCallback
});
});


[jQuery] put image on top of another image

2008-09-09 Thread cc96ai

I m new on jquery,
I am not can jquery can do or not
I want to put a image on top of other image,
e.g. we have a product image, we want to put a sign of sold or hot
buy image on top ,
any idea how could I do it in jquery ?