[jQuery] Selectbox

2009-09-15 Thread Richard Walsh

I remember seeing a sample somewhere, now for the life of me when I
actually need to use it. I can't remember how or where I found it. I
am hoping someone can shed some light.

What I want to achieve, is when a value is picked in a select box, an
empty input field appears after a value is selected. If someone can
point me in the right direction it would be great!

Thanks


[jQuery] Selectbox Manipulation...Works in FF but not in IE6 or IE7

2009-02-26 Thread Chris Jordan
Hi folks,

I'm trying to manipulate which item in a select box is selected using
jQuery. The following code snippet works great in FF but fails miserably in
IE6 and IE7

 // select the publish to option
$(#PublishToID  option).each(function(){
$this = $(this);
if($this.attr(textContent) == PublishTo){
$this.attr(selected, true)
}
});


Given that I have a select box that looks like this:

select name=PublishTo id=PublishToID
option value=3Some Page Title/option
option value=4Some Other Page Title/option
option value=5Page 5/option
option value=1Page 1/option
option value=2Page 2/option
/select

-- 
http://cjordan.us


[jQuery] jQuery + SelectBox + IE don't work

2008-02-11 Thread Mr Bola A Bola

There is some problem with this script working in IE. It works in
FireFox. The whole thing consists of HTML page, JS file and CSS file.
The following html page is validated XHTML. It contains Select box and
two anchors for filtering the content of that select box.
One filter filters options by first letter. The other filter is toggle
type.

!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en
head
title/title
meta http-equiv=Content-Type content=text/html; 
charset=utf-8 /

link rel=stylesheet type=text/css href=style.css /
script type=text/javascript src=jquery/jquery-1.2.3.js/
script
script type=text/javascript src=script.js/script
/head
body
a id=toggle href=Just own/Not just own/a
br /
a id=alphabetall href=#Все/a
a class=alphabet href=#A/a
a class=alphabet href=#B/a
a class=alphabet href=#C/a
a class=alphabet href=#P/a
br /
select id=market
option class=product own value=0/option
option class=product own A value=11Apple/option
option class=product own B value=12Banana/option
option class=product own A 
value=13Apricot/option
option class=product P value=21Potato/option
option class=product own P value=14Peach/option
option class=product C value=22Carrot/option
option class=product C value=23Cabbage/option
/select
/body
/html

Script file is quite simple and follows:

$(document).ready(function(){
$(.alphabet).click(function() {
var al = $(this).html();
if(onlyown==0) {
$(.product).hide();
alert($(.product).text());
$(.product).hide().filter(.+al).show();
$(#market).val(0);
} else if(onlyown==1) {
$(.product).hide().filter(.own.+al).show();
$(#market).val(0);
}
return false;
});


//*When All is clicked show all records
$(#alphabetall).click(function() {
if(onlyown==0) {
$(.product).show()
return false;
} else if (onlyown==1) {
$(.product.own).show()
return false;
}
});


//*When this is toggled show only OWN or ALL records
var onlyown=0;
$(#toggle).click(function() {
if(onlyown==0) {
$(.product).hide().filter(.own).show();
onlyown=1;
} else if (onlyown==1) {
$(.product).show();
onlyown=0;
}
return false;
});
});

Just in case here is CSS:

.product {
font-family:Arial;
color:green;
}
.own {
font-weight:bold;
color:blue;
}


[jQuery] selectbox: change selected item

2007-07-17 Thread zenx

Hi,

I don't know how to change the selected item in a selectbox. I tried
this but it doesn't work as expected.

HTML code:
=
select id=id_cliente name=cliente size=1
option value= selected=selected-/option
option value=1First/option
option value=2Second/option
/select

javascript code:

var cliente = 2;
$('#id_cliente:nth-child(cliente)').attr('selected','selected');

any ideas?

Thank you!