daGrevis Posted November 27, 2010 Report Posted November 27, 2010 Sveiki, Veidoju mazu jQ skriptiņu, kurš... Visiem "a" tagiem, kuriem nav "title" atribūts pievieno to ar saturu, kāds ir starp attiecīgajiem tagiem. $(function() { $( 'a' && !'a[title]' ) .each( function() { $( this ).attr( 'title', $( this ).text() ) } ); } ); Problēma ir tieši ar to, ka nemāku definēt to, ka tiem kuriem nav "title" atribūts, jo jQ īsti nerunā Manā valodā. Ņēmu "!" kā no PHP, bet kaut kas "ģļučī"... xD Quote
Rincewind Posted November 27, 2010 Report Posted November 27, 2010 Pamēģini $('a:not(a[title])') Quote
rATRIJS Posted November 28, 2010 Report Posted November 28, 2010 var me = false; jQuery("a:not([title])").each(function() { me = jQuery(this); me.attr('title', me.html()); }); Vienkaarshi shaadi... Teoreetiski selektoram vajadzeetu sekot xPath sintaksei (http://en.wikipedia.org/wiki/XPath), tiesa jQuery gadiijumaa ne vienmeer taa ir...neesmu 100% droshs, bet pareizs xPath buutu 'a[not(@title)]' Quote
daGrevis Posted November 28, 2010 Author Report Posted November 28, 2010 Strādā! =) a:not(a[title]) Paldies. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.