[jQuery] Re: Type of Control

2008-12-08 Thread JQueryProgrammer

This is also one good way to get the type of the control. But is there
any generic function that I can extend with jQuery in which I pass the
control id and it returns me the type of the control whether it be
div, span, select, textarea etc etc.

On Dec 8, 4:00 pm, Richard D. Worth [EMAIL PROTECTED] wrote:
 Another option would be to use the .is() method in combination with jQuery
 form (pseudo-)selectors like select textarea :radio :checkbox
 :hidden See

 http://docs.jquery.com/Selectors

 the Forms: section for a list of the form pseudo-selectors.

 - Richard

 On Mon, Dec 8, 2008 at 5:34 AM, JQueryProgrammer [EMAIL PROTECTED]wrote:



  Thanks for the help.

  On Dec 8, 3:28 pm, Kayhadrin [EMAIL PROTECTED] wrote:
   If you try $(#mycontrolid).attr('type'), you should find the type of
   INPUT tag you have.

   On Dec 8, 9:05 pm, JQueryProgrammer [EMAIL PROTECTED] wrote:

How can I check what is the type of control. eg.

In javascript document.getElementById(mycontrolid).type will return
select-one, textbox, checkbox, radio etc.

How can I find it in jQuery. I tried as

$(#mycontrolid).constructor but it returns as Object in all cases.


[jQuery] Re: Type of Control

2008-12-08 Thread JQueryProgrammer

Thanks for the help.

On Dec 8, 3:28 pm, Kayhadrin [EMAIL PROTECTED] wrote:
 If you try $(#mycontrolid).attr('type'), you should find the type of
 INPUT tag you have.

 On Dec 8, 9:05 pm, JQueryProgrammer [EMAIL PROTECTED] wrote:

  How can I check what is the type of control. eg.

  In javascript document.getElementById(mycontrolid).type will return
  select-one, textbox, checkbox, radio etc.

  How can I find it in jQuery. I tried as

  $(#mycontrolid).constructor but it returns as Object in all cases.


[jQuery] Re: Type of Control

2008-12-08 Thread Kayhadrin

If you try $(#mycontrolid).attr('type'), you should find the type of
INPUT tag you have.

On Dec 8, 9:05 pm, JQueryProgrammer [EMAIL PROTECTED] wrote:
 How can I check what is the type of control. eg.

 In javascript document.getElementById(mycontrolid).type will return
 select-one, textbox, checkbox, radio etc.

 How can I find it in jQuery. I tried as

 $(#mycontrolid).constructor but it returns as Object in all cases.


[jQuery] Re: Type of Control

2008-12-08 Thread Richard D. Worth
It depends on what you mean by type of control. Do you mean any html
element? Any form control? As for the tag name, you can get that of any
element by it's id like so

var tagName = $(#theId).attr(tagName);

That won't help you with any of the input controls that share the INPUT
tagName, which is where you would want to use .attr(type) as Kayhadrin
suggested. So you could write a jquery plugin that returned tagName, unless
it was INPUT, and in that case returned type. That about what you're looking
for?

- Richard

On Mon, Dec 8, 2008 at 6:17 AM, JQueryProgrammer [EMAIL PROTECTED]wrote:


 This is also one good way to get the type of the control. But is there
 any generic function that I can extend with jQuery in which I pass the
 control id and it returns me the type of the control whether it be
 div, span, select, textarea etc etc.

 On Dec 8, 4:00 pm, Richard D. Worth [EMAIL PROTECTED] wrote:
  Another option would be to use the .is() method in combination with
 jQuery
  form (pseudo-)selectors like select textarea :radio :checkbox
  :hidden See
 
  http://docs.jquery.com/Selectors
 
  the Forms: section for a list of the form pseudo-selectors.
 
  - Richard
 
  On Mon, Dec 8, 2008 at 5:34 AM, JQueryProgrammer 
 [EMAIL PROTECTED]wrote:
 
 
 
   Thanks for the help.
 
   On Dec 8, 3:28 pm, Kayhadrin [EMAIL PROTECTED] wrote:
If you try $(#mycontrolid).attr('type'), you should find the type
 of
INPUT tag you have.
 
On Dec 8, 9:05 pm, JQueryProgrammer [EMAIL PROTECTED] wrote:
 
 How can I check what is the type of control. eg.
 
 In javascript document.getElementById(mycontrolid).type will
 return
 select-one, textbox, checkbox, radio etc.
 
 How can I find it in jQuery. I tried as
 
 $(#mycontrolid).constructor but it returns as Object in all
 cases.



[jQuery] Re: Type of Control

2008-12-08 Thread Richard D. Worth
Another option would be to use the .is() method in combination with jQuery
form (pseudo-)selectors like select textarea :radio :checkbox
:hidden See

http://docs.jquery.com/Selectors

the Forms: section for a list of the form pseudo-selectors.

- Richard

On Mon, Dec 8, 2008 at 5:34 AM, JQueryProgrammer [EMAIL PROTECTED]wrote:


 Thanks for the help.

 On Dec 8, 3:28 pm, Kayhadrin [EMAIL PROTECTED] wrote:
  If you try $(#mycontrolid).attr('type'), you should find the type of
  INPUT tag you have.
 
  On Dec 8, 9:05 pm, JQueryProgrammer [EMAIL PROTECTED] wrote:
 
   How can I check what is the type of control. eg.
 
   In javascript document.getElementById(mycontrolid).type will return
   select-one, textbox, checkbox, radio etc.
 
   How can I find it in jQuery. I tried as
 
   $(#mycontrolid).constructor but it returns as Object in all cases.