Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

jquery - Javascript -- filter set of links and style -


here set of links:

<ul id="power">     <li><a id="10watt" name="power" href="#">10 watt</a></li>     <li><a id="25watt" name="power" href="#">25 watt</a>     <li><a id="30watt" name="power" href="#">30 watt</a>     <li><a id="40watt" name="power" href="#">40 watt</a>     <li><a id="50watt" name="power" href="#">50 watt</a>     <li><a id="60watt" name="power" href="#">60 watt</a>     <li><a id="75watt" name="power" href="#">75 watt</a>     <li><a id="100watt" name="power" href="#">100 watt</a>     <li><a id="120watt" name="power" href="#">120 watt</a>     <li><a id="150watt" name="power" href="#">150 watt</a> </ul> 

and have array:

var 9 = ['25watt','30watt','40watt','50watt','60watt','75watt']; 

i want filter links ones not in array styled "unavailable" class defined in css. here jquery.

if (this.id == '93') {            $('a [name="power"]').filter(function() {                if ($.inarray($(this).attr('id'), nine) < 0)                $(this).addclass('unavailable');                $(this).removeattr('href');            });       } 

this.id comes previous set of links, how write filter statement, because have isn't working. help.

this should work:

$('a[name="power"]').filter(function() {     return $.inarray($(this).attr('id'), nine) == -1; }).addclass('unavailable').removeattr('href'); 

your selector had space between a , [name="power"], means selecting [name="power"] descendants of a, not a itself. besides that, corrected filter function filtering only.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -