Karl, Any particular reason why you would use a link to click the button to perform the button's task, rather than just disposing of the button and assigning its task to the link? If that made no sense ;-) take an example: why create an invisible button to save, then use jQuery to create a link out of it, when you could just write this: <a href="javascript:save()">Save</a> It removes the need to modify the DOM unnecessarily and also means that the source HTML shows more closely its final content.
James, Good question...first assumption would be it varies between browsers. Offhand I think most do not show the updated source, however a tool such as Firebug [http://www.getfirebug.com/] will show the updated DOM instead. You'd have to test it with your browser to find out for sure. --rob On 5/23/07, james_027 <[EMAIL PROTECTED]> wrote:
Hi rob, Thanks very much, that really gives me a lot info. I'll take your suggestion ... Another question ... You mention about the browser to update its DOM with $('p').click(...) does this update can be seen when your view the source or it is done internally? Thanks again james On May 22, 10:56 pm, "Rob Desbois" <[EMAIL PROTECTED]> wrote: > James, > > The <button> tag is a different element created to allow much more control > over styling and content - you can include markup such as images and styling > in a <button> tag which is not possible with <input type="button"> > > As for which of the two approaches I prefer - I'd go for <a > href="javascript:foo()"> as the javascript IS the link target, creating an > onclick() handler and putting a fake value in the href attribute is to my > mind misusing the tag. > > Alexandre's approach works - however unless you need to dynamically assign > different click event handlers, I think it is better to put the event > handler into the source rather than setting it with jQuery. > Why force the browser to update its DOM with $('p').click(...) once the > page is loaded when you can set it just by coding the tag? It'll slow the > browser slightly as it updates the page after loading, which is cumulative > if you have to do it for many links/tags. > > Hope all that info helps! > --rob > > On 5/22/07, james_027 <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > what is the difference between <input type="button"> to <button> > > > Thanks > > james > > On May 22, 5:20 pm, Bob den Otter <[EMAIL PROTECTED]> wrote: > > > james_027 wrote: > > > > Hi, > > > > > Is this the best way to make a text button? > > > > > <a href="#">Click Me!</a> > > > > Slightly offtopic, but you might want to look into this: > >http://particletree.com/features/rediscovering-the-button-element/ > > > > Besides the <button> tag, they also go into styling <a> tags to resemble > > > buttons. > > > > Best, Bob. > > -- > Rob Desbois > Eml: [EMAIL PROTECTED] > Tel: 01452 760631 > Mob: 07946 705987 > "There's a whale there's a whale there's a whale fish" he cried, and the > whale was in full view. > ...Then ooh welcome. Ahhh. Ooh mug welcome.
-- Rob Desbois Eml: [EMAIL PROTECTED] Tel: 01452 760631 Mob: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.