daGrevis Posted November 27, 2010 Report Share 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 Link to comment Share on other sites More sharing options...
Rincewind Posted November 27, 2010 Report Share Posted November 27, 2010 Pamēģini $('a:not(a[title])') Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted November 28, 2010 Report Share 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 Link to comment Share on other sites More sharing options...
daGrevis Posted November 28, 2010 Author Report Share Posted November 28, 2010 Strādā! =) a:not(a[title]) Paldies. Quote Link to comment Share on other sites More sharing options...
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.