jquery - How to select id from a single form -


i have this

$('#edit-preview') .addclass("popup"); $('#edit-submit') .addclass("nopopup"); $('#edit-save-to-sandbox') .addclass("sandboxnopopup"); $("#node-form").attr('target', '_blank');  $('.nopopup').click(function(e) {     e.preventdefault(); //prevents default submit action     $("#node-form").removeattr('target').submit().attr('target', '_blank'); });  $('.sandboxnopopup').click(function(e) {     $("#node-form").removeattr('target'); }); 

but button have input id=edit-submit or edit-preview have same function... want edit-submit or edit-preview in #node-form... can help? sorry english

warning! ids should unique in whole html document.

you can't have 2 inputs same id. it's bad because!

hard find documentation because it's 1 of basic concepts of html in first place.

use classes!

anyways, select children of element can this:

$('#edit-preview, #edit-submit', $('#node-form')) 

which should

$('.edit-preview, .edit-submit', $('#node-form')) 

since you're using classes identify semantically similar elements ;-)


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -