Hi Jamie,
this is pretty easy :)
jQuery uses CSS Selectors, so this will work:
$("input, select").click(function() {
jamester wrote:
>
> Hi all,
>
> I've just entered the wonderful world of jquery, and being from a mainly
> php only background the whole JS thing is very new and exciting to me, but
> the learning curve is steep!
>
> I'm sure this is such a basic question, but I don't want to hack in
> something really ugly to make it work when the whole thing about jq is the
> simplicity.
>
> I want to trigger some code when a radio button changes so:
> $("input").click(function() {
> Kicks that off nicely and all is well in the world.
>
> However, within the form there are also a couple of selects. Now I could
> just duplicate everything or push the extra code off to a function to
> call, but what I really want to know is if there is a selector like this:
> $("input|select").click(function() {
>
> Any way of combining those two in the same line?
>
> Many thanks to all who took the time to read.
>
> Jamie
>
jamester wrote:
>
> Hi all,
>
> I've just entered the wonderful world of jquery, and being from a mainly
> php only background the whole JS thing is very new and exciting to me, but
> the learning curve is steep!
>
> I'm sure this is such a basic question, but I don't want to hack in
> something really ugly to make it work when the whole thing about jq is the
> simplicity.
>
> I want to trigger some code when a radio button changes so:
> $("input").click(function() {
> Kicks that off nicely and all is well in the world.
>
> However, within the form there are also a couple of selects. Now I could
> just duplicate everything or push the extra code off to a function to
> call, but what I really want to know is if there is a selector like this:
> $("input|select").click(function() {
>
> Any way of combining those two in the same line?
>
> Many thanks to all who took the time to read.
>
> Jamie
>
--
View this message in context:
http://www.nabble.com/Such-a-Newbie-question-tf2900434.html#a8108977
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/