Search Results

Search found 359 results on 15 pages for 'ol'.

Page 2/15 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • In iPhone OS, what UTI represents a plain ol' text file?

    - by Justin Searls
    I'm attempting to make use of the UIDocumentInteractionController mechanism in iPhone OS 3.2, but I'm struggling to figure out exactly how to construct a UTI that it likes. I've gotten as far as attempting to set "public.plain-text", but it's hard to test whether this is the correct UTI for a plain text document, since I can't tell whether the issue is that my iPad doesn't have any apps that support plain text import. (I figured Pages would, but I suppose perhaps not, since it will attempt and fail to load any files with the extension .pages, regardless of UTI). Any seasoned OS X developers that can help on this?

    Read the article

  • Neither if nor else will run

    - by Arlen Beiler
    I don't know what the problem is. This is the code that is the problem: $thisvb = (int) $key2; if ($thisvb == ($lastvb + 1)) { //This don't work echo '<li>'; } else { '<li value="' . $key2 . '">';} $last = (int) $key2; Below is the full code. <?php $voiceboxes = array( '141133' => array( '1' => array( 'Title' => 'Title2', 'Link' => 'http://...', ), '2' => array( 'Title' => 'Title3', 'Link' => 'http://...', ), '3' => array( 'Title' => 'Title4', 'Link' => 'http://...', ) ) ); $last = 0; //$this = 0; echo "<ol>\n"; foreach ($voiceboxes as $key => $value) { $lastvb = 0; $thisvb = 0; //$voiceboxes[$key]['title'] echo "<ol>\n"; foreach ($value as $key2 => $value2) { $thisvb = (int) $key2; if ($thisvb == ($lastvb + 1)) { //This don't work echo '<li>'; } else { '<li value="' . $key2 . '">';} $last = (int) $key2; echo $voiceboxes[$key][$key2]['Title'] . "<br/>" . $voiceboxes[$key][$key2]['Link'] . '</li>' . "\n"; } } echo "</ol>\n"; echo '</ol>'; ?> This is what I get <ol> <ol> <li>Title2<br/>http://...</li> Title3<br/>http://...</li> <!-- this ain't right, it should start with <li> --> Title4<br/>http://...</li> <!-- same here --> </ol> </ol> I can't figure it out, does anyone know?

    Read the article

  • Inheritance of list-style-type property in Firefox (bug in Firebug?)

    - by Marcel Korpel
    Let's have a look at some comments on a page generated by Wordpress (it's not a site I maintain, I'm just wondering what's going on here). As these pages might disappear in the near future, I've put some screenshots online. Here's what I saw: Obviously, the list-item markers shouldn't be there. So I decided to look at the source using Firebug. As you can see, Firebug claims that the list-style property (containing none) is inherited from ol.commentlist. But if that's the case, why are the circle and the square visible? When checking the computed style, Firebug shows the list-style-types correctly. What's the correct behaviour? I just did a quick check in Chromium, whose Web Inspector gave a better view of reality (the list item markers were also displayed in this browser): According to WebKit, list-style of ol.commentlist isn't inherited, only the default value of list-style-type from the rendering engine. So, we may conclude that the output of both browsers is correct and that Firefox (Firebug) shows an incorrect representation of inherited styles. What does the CSS specification say? Inheritance will transfer the list-style values from OL and UL elements to LI elements. This is the recommended way to specify list style information. Not much about the inheritance of ol properties to uls. Is Firebug wrong in this respect? BTW, I managed to let the markers disappear by just changing line 312 of style.css to ol.commentlist, li.commentlist, ul.children { When also explicitly defining the list-style of ul.children to none, the markers are not painted. You can have a look at screenshots of Firebug and WebKit's Web Inspector in this case, if you like.

    Read the article

  • Wrap several elements for accordion in jquery

    - by daveredfern
    Hello, I currently have the following html:- <h3 /> <p /> <p /> <ul /> <ol /> <h3 /> <p /> <p /> <ul /> <ol /> <h3 /> <p /> <p /> <ul /> <ol /> I'd like to create an accordion but for this I need the following:- <h3 /> <div> <p /> <p /> <ul /> <ol /> </div> <h3 /> <div> <p /> <p /> <ul /> <ol /> </div> I have tried the following:- $('.page2 .articleText p, .page2 .articleText ul').after('<div class="accordion">'); $('.page2 .articleText h4:not(:first)').before('</div>'); But this doesnt work. ANy help is much appreciated. Thanks!

    Read the article

  • Possible to bind an event listener to a (hypothetical) onChangeInnerHTML event?

    - by DustMason
    In my app, I have an OL tag whose contents are changed by various other dynamic events. Is there some way to put a listener on that OL so that I can execute a function whenever its contents are altered in any way? In this example I need to update a count of items in the list which appears in another spot in the interface. I am using jQuery if that helps. The contents of the OL are being changed with OL.append() and LI.remove(), in case those methods have some special events that I don't know about Thanks!

    Read the article

  • Is there a more elegant solution than an if-statement with no else clause?

    - by Jay
    In the following code, if Control (the element that trigers Toggle's first OL) is not Visible it should be set Visible and all other Controls (Controls[i]) so be Hidden. .js function Toggle(Control){ var Controls=document.getElementsByTagName("ol",document.getElementById("Quote_App")); var Control=Control.getElementsByTagName("ol")[0]; if(Control.style.visibility!="visible"){ for(var i=0;i<Controls.length;i++){ if(Controls[i]!=Control){ Reveal("hide",20,0.3,Controls[i]); }else{ Reveal("show",20,0.3,Control); }; }; }else{ Reveal("hide",20,0.3,Control); }; }; Although the function [Toggle] works fine, it is actually setting Controls[i] to Hidden even if it is already. This is easily rectified by adding an If statement as in the code below, surely there is a more elegant solution, maybe a complex If condition? .js function Toggle(Control){ var Controls=document.getElementsByTagName("ol",document.getElementById("Quote_App")); var Control=Control.getElementsByTagName("ol")[0]; if(Control.style.visibility!="visible"){ for(var i=0;i<Controls.length;i++){ if(Controls[i]!=Control){ if(Controls[i].style.visibility=="visible"){ Reveal("hide",20,0.3,Controls[i]); }; }else{ Reveal("show",20,0.3,Control); }; }; }else{ Reveal("hide",20,0.3,Control); }; }; Your help is appreciated always.

    Read the article

  • Getting HIERARCHY_REQUEST_ERR when using Javascript to recursively generate a nested list

    - by Mark
    I have a method that is trying to take in a list. This list can contain data and other lists. The end goal is to try to convert something like this ["a", "b", ["c", "d"]] into <ol> <li> <b>a</a> </li> <li> <b>b</a> </li> <ol> <li> <b>c</a> </li> <li> <b>d</a> </li> </ol> </ol> The code is: function $(tagName) { return document.createElement(tagName); } //returns an html element representing data //data should be an array or some sort of value function tagMaker(data) { tag = null; if(data instanceof Array) { //data is an array, represent using <ol> tag = $("ol"); for(i=0; i<data.length; i++) { //construct one <li> for each item in the array listItem = $("li"); //get the html element representing this particular item in the array child = tagMaker(data[i]); //<li>*html for child*</li> listItem.appendChild(child); //add this item to the list tag.appendChild(listItem); } } else { //data is not an array, represent using <b>data</b> tag = $("b"); tag.innerHTML = data.toString(); } return tag; } Calling tagMaker throws HIERARCHY_REQUEST_ERR: DOM Exception 3, rather than generating a helpful HTML element object which I was planning to append to document.body.

    Read the article

  • How can I set/store cookie when anchor clicked

    - by Unaverage Guy
    I am trying to use Cookie so that a default style OR a specific style is applied in reference to the anchor tag clicked, even when the browser is closed/reopen. So if the user clicked the second link, close or refresh the browser and reopen, than the style should still be active, if it is their first time the default should apply. This is a little over my turf. Here is the HTML: <a id="default" href="#/">Default Style</a> <a id="style2" href="#/">Style 2</a> <a id="style3" href="#/">Style 3</a> <ol> <li><span>Hello World</span></li> </ol> JQuery: (Compliments of StackOverflow) <script type="text/javascript"> $('#default').on('click',function(){ $('ol li span').removeClass(function() { return $(this).attr('class'); }).addClass('default'); }); $('#style2').click(function(){ $('ol li span').removeClass(function() { return $(this).attr('class'); }).addClass('style2'); }); $('#style3').click(function(){ $('ol li span').removeClass(function() { return $(this).attr('class'); }).addClass('style3'); }); </script> CSS: <style type="text/css"> .default{ color: #333; } .style2{ color: #999; } .style3{ color: #800; } </style>

    Read the article

  • IIS wont run a BAT File

    - by Ye Ol Developer
    The problem we have run into is as follows. We have an ASP.NET WebService which runs under IIS7. The code in the WebService works 100%, however when the WebService tries to run a .BAT file, nothing happens. Nothing at all, the code doesn't crash, the server doesn't warn us about anything, nothing at all. We have tried setting the User Permissions, we have attempted difference ways of running the BAT, we have tried playing around with the registry, cmd.exe has full rights as well. We are now quite stumped as of what to do, any help would be appreciated.

    Read the article

  • Windows NLB + IIS - Stops serving pages

    - by Ye Ol Developer
    We are currently running Windows NLB and IIS7 load balanced across two servers. What happens is randomly and sporadically the servers stop serving web pages. What we have noticed is that if we run the sites on a dedicated IP on either of the servers, these issues do not exist. As soon as we switch back to the load balanced IP, then everything goes awry. When the servers stop serving pages, we can still TS into the server and surf them internally without issues, or switch to the dedicated IP. However the internal network cannot even access the files from the load balanced IP. We are running out of idea's here. Has anyone had a similar problem?

    Read the article

  • using '.each' method: how do I get the indexes of multiple ordered lists to each begin at [0]?

    - by shecky
    I've got multiple divs, each with an ordered list (various lengths). I'm using jquery to add a class to each list item according to its index (for the purpose of columnizing portions of each list). What I have so far ... <script type="text/javascript"> /* Objective: columnize list items from a single ul or ol in a pre-determined number of columns 1. get the index of each list item 2. assign column class according to li's index */ $(document).ready(function() { $('ol li').each(function(index){ // assign class according to li's index ... index = li number -1: 1-6 = 0-5; 7-12 = 6-11, etc. if ( index <= 5 ) { $(this).addClass('column-1'); } if ( index > 5 && index < 12 ) { $(this).addClass('column-2'); } if ( index > 11 ) { $(this).addClass('column-3'); } // add another class to the first list item in each column $('ol li').filter(function(index) { return index != 0 && index % 6 == 0; }).addClass('reset'); }); // closes li .each func }); // closes doc.ready.func </script> ... succeeds if there's only one list; when there are additional lists, the last column class ('column-3') is added to all remaining list items on the page. In other words, the script is presently indexing continuously through all subsequent lists/list items, rather than being re-set to [0] for each ordered list. Can someone please show me the proper method/syntax to correct/amend this, so that the script addresses/indexes each ordered list anew? many thanks in advance. shecky p.s. the markup is pretty straight-up: <div class="tertiary"> <h1>header</h1> <ol> <li><a href="#" title="a link">a link</a></li> <li><a href="#" title="a link">a link</a></li> <li><a href="#" title="a link">a link</a></li> </ol> </div><!-- END div class="tertiary" -->

    Read the article

  • How do I center this CSS?

    - by sarthaksss
    Here is the CSS - #slider ul, #slider li, #slider2 ul, #slider2 li{ margin:0; padding:0; list-style:none; } #slider2{margin-top:1em;} #slider li, #slider2 li{ /* define width and height of list item (slide) entire slider area will adjust according to the parameters provided here */ width:500px; height:250px; overflow:hidden; } #prevBtn, #nextBtn, #slider1next, #slider1prev{ display:block; width:30px; height:77px; position:absolute; left:-30px; top:71px; z-index:1000; } #nextBtn, #slider1next{ left:696px; } #prevBtn a, #nextBtn a, #slider1next a, #slider1prev a{ display:block; position:relative; width:30px; height:77px; background:url(../images/btn_prev.gif) no-repeat 0 0; } #nextBtn a, #slider1next a{ background:url(../images/btn_next.gif) no-repeat 0 0; } /* numeric controls */ #slider img{ width:500px; height:300px; } ol#controls{ margin:1em 0; padding:0; height:28px; } ol#controls li{ margin:0 10px 0 0; padding:0; float:left; list-style:none; height:28px; line-height:28px; } ol#controls li a{ float:left; height:28px; line-height:28px; border:1px solid #ccc; background:#b32d45; color:white; padding:0 10px; text-decoration:none; } ol#controls li.current a{ background:#5DC9E1; color:#fff; } ol#controls li a:focus, #prevBtn a:focus, #nextBtn a:focus{outline:none;} I want to center the #slider HTML <div id="slider"> <ul> <li>IMAGE</li> <li>IMAGE2</li> </ul> </div>

    Read the article

  • Why doesn't my processor have built-in BigInt support?

    - by ol
    As far as I understood it, BigInts are usually implemented in most programming languages as strings containing numbers, where, eg.: when adding two of them, each digit is added one after another like we know it from school, e.g.: 246 816 * * ---- 1062 Where * marks that there was an overflow. I learned it this way at school and all BigInt adding functions I've implemented work similar to the example above. So we all know that our processors can only natively manage ints from 0 to 2^32 / 2^64. That means that most scripting languages in order to be high-level and offer arithmetics with big integers, have to implement/use BigInt libraries that work with integers as strings like above. But of course this means that they'll be far slower than the processor. So what I've asked myself is: Why doesn't my processor have a built-in BigInt function? It would work like any other BigInt library, only (a lot) faster and at a lower level: Processor fetches one digit from the cache/RAM, adds it, and writes the result back again. Seems like a fine idea to me, so why isn't there something like that?

    Read the article

  • Number nested ordered lists in HTML

    - by John
    Hi I have a nested ordered list. <ol> <li>first</li> <li>second <ol> <li>second nested first element</li> <li>second nested secondelement</li> <li>second nested thirdelement</li> </ol> </li> <li>third</li> <li>fourth</li> </ol> Currently the nested elements start back from 1 again, e.g. first second second nested first element second nested second element second nested third element third fourth What I want is for the second element to be numbered like this: first second 2.1. second nested first element 2.2. second nested second element 2.3. second nested third element third fourth Is there a way of doing this? Thanks

    Read the article

  • XML and XSL connection

    - by Irgat
    I have a problem between XML and XSL files. In XML file, there are some elements such as *<school><student studentID="12345"><nameStud I</name<takesCMPE471</takes<takesCMPE412</takes<takesCMPE100</takes</student<student studentID="67890"><nameStud II</name<takesCMPE471</takes<takesCMPE412</takes</student<course courseCode="CMPE471"<courseName>NAME I </courseName> <description>DESC I </description> </course><course courseCode="CMPE412"<courseName>NAME II </courseName> <description>DESC II </description> </course><course courseCode="CMPE100"<courseName>NAME III </courseName> <description>DESC III </description> </course>In XSL file,I want to reach "description" element which I specified "courseCode".Output should be like this, 1. Stud I      a. CMPE471 Desc I      b. CMPE412 Desc II     c. CMPE100 Desc III2. Stud II      a. CMPE471 Desc I     b. CMPE412 Desc II In XSL file, I tried to write something : <ol <xsl:for-each select="/school/student" <xsl:sort data-type="text" order="ascending" select="name"/ <li<xsl:value-of select="name"/ <ol type="a" <xsl:for-each select="takes" <xsl:sort data-type="text" select="text()" order="ascending"/ <li <xsl:for-each select="/school/course"//PROBLEM <xsl:value-of select="description [@courseCode = text()]"///PROBLEM </xsl:for-each//PROBLEM </li </xsl:for-each </ol </xsl:for-each </ol Thanks.

    Read the article

  • foreach() error handling - how do make it do nothing?

    - by Jared
    Hey all, This should be very basic, but I am a little stumped! Here is my array: $menu = array( 'Home', 'Stuff'=>array( 'Losta Stuff', 'Less Stuff', 'Ur moms stuff', 'FAQ' ), 'Public Works' ); Here is my logic: echo "<ol>\n"; foreach( (array)$menu as $header ) { echo ' <li><b>'.$header."</b><br />\n"; echo ' <ol>'; foreach( (array)$header as $headers ) { echo ' <li>'.$headers.".</li>\n"; } echo ' </ol>'; } echo "</ol>\n"; As you can see, Home and Public Works don't have data in the them, so I get a Warning: Invalid argument supplied for foreach() in test.php on line ## If I add (array) to $header like this: foreach( (array)$header as $headers ), It no longer gives me the error, but it just displays the $header as the $headers (i.e. Home - Home, Instead of Home - nothing). Basically, if the data is empty, I want it to do nothing!

    Read the article

  • spyr validation text with jquery serialize()

    - by oz1453
    Code like this : <form> <ol> <li> <fieldset> <legend>test</legend> <ol> <li> <label for="qwerty">qwerty</label> <span id="sprytextfield1"> <input name="qwerty" type="text" id="qwerty" /> <span class="textfieldRequiredMsg">error no qwerty input</span></span> </li> </ol> </fieldset> </li> </ol> <p style="text-align:right;"> <input type="reset" value="reset" /> <input type="submit" value="submit" /> </p> </form> <script type="text/javascript"> $('form').submit(function() { alert($(this).serialize()); return false; }); <!-- var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {validateOn:["blur"]}); //--> </script> I want to do. when i click the submit button serialize the form but when no error with spyr. if the spyr validation text error appears don t serialize or alert. i think.i must make a if condition before alert.

    Read the article

  • Removing empty space with jQuery after deleting Selectable item

    - by Tx3
    I have two ordered lists and user can move items between them. I am using jQuery UI's Selectable for both of them. Problem is that when I move item from the middle of the list it leaves an empty space behind. How can I make list shrink according to the how many items is actually in the list? HTML <ol id="allUnits"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> </ol> <input id="arrowRight" type="image" alt="Move item to right" src="<%= Url.Content("~/Content/Images/arrowRight.png")%>" /> <input id="arrowLeft" type="image" alt="Move item to left" src="<%= Url.Content("~/Content/Images/arrowLeft.png")%>" /> <ol id="productUnits"> <li class="ui-state-default">Item 1</li> <li class="ui-state-default">Item 2</li> <li class="ui-state-default">Item 3</li> <li class="ui-state-default">Item 4</li> <li class="ui-state-default">Item 5</li> </ol> jQuery $().ready(function () { $("#allUnits").selectable(); $("#productUnits").selectable(); $('#arrowRight').click(function () { return !$('#allUnits .ui-selected').remove().appendTo('#productUnits').removeClass(".ui-selected"); }); $('#arrowLeft').click(function () { return !$('#productUnits .ui-selected').remove().appendTo('#allUnits').removeClass(".ui-selected"); }); });

    Read the article

  • prolog recursion

    - by AhmadAssaf
    am making a function that will send me a list of all possible elemnts .. in each iteration its giving me the last answer .. but after the recursion am only getting the last answer back .. how can i make it give back every single answer .. thank you the problem is that am trying to find all possible distributions for a list into other lists .. the code test :- bp(3,12,[7, 3, 5, 4, 6, 4, 5, 2], Answer), format("Answer = ~w\n",[Answer]). bp(NB,C,OL,A):- addIn(C,OL,[[],[],[]],A); bp(NB,C,_,A). addIn(_,[],Result,Result). addIn(C,[Element|Rest],[F|R],Result):- member( Members , [F|R]), sumlist( Members, Sum), sumlist([Element],ElementLength), Cap is Sum + ElementLength, (Cap =< C, append([Element], Members,New), insert( Members, New, [F|R], PartialResult), addIn(C,Rest,PartialResult,Result)). by calling test .. am getting back all the list of possible answers .. now if i tried to do something that will fail like bp(3,11,[8,2,4,6,1,8,4],Answer). it will just enter a while loop .. more over if i changed the bp(NB,C,OL,A):- addIn(C,OL,[[],[],[]],A); bp(NB,C,_,A). to and instead of Or .. i get error : ERROR: is/2: Arguments are not sufficiently instantiated appreciate the help .. Thanks alot @hardmath

    Read the article

  • Using innerHTML to add ordered list fails in IE

    - by Matt
    I'm using the following Javascript code to populate a DIV with an ordered list: // send script back in split list var scriptList = script.split("\n"); var finalScript = "<ol>\n"; var count = 0; while(scriptList.length >= count) { if((scriptList[count]=="") || (scriptList[count] == undefined)) { count ++; continue; } finalScript = finalScript + "<li>" + scriptList[count] + "</li>\n"; count ++; } finalScript = finalScript + "</ol>"; scriptingDiv.innerHTML = finalScript; In firefox, if i look in the DOM using Firebug, this correctly translates to the following and correctly displays an ordered list. <ol> <li>This is the first item in the list</li> <li>This is the second item in the list</li> </ol> In IE, it displays as if the </li> tags are <br /> tags and ignores all the other tags, like this: This is the first item in the list This is the second item in the list Do I need to dynamically add the ordered list to the DOM for this to work? As opposed to just setting the html code in the div using .innerHTML? TIA

    Read the article

  • No route matches [PUT] error in active_admin

    - by Alex
    in active_admin partials created a form input: <%= semantic_nested_form_for @item, :url => admin_items_path(@item) do |f| %> <fieldset class="inputs"> <ol> <%= f.input :category %></br> <%= f.input :title %> <%= f.input :photo1 %> <%= f.input :photo2 %> </ol> </fieldset> <%= f.fields_for :ItemColors do |i| %> <fieldset class="inputs"> <ol> <%= i.input :DetailColor %> <%= i.input :size, :input_html => { :size => "10" } %> <%= i.link_to_remove "remove" %> </ol> </fieldset> <% end %> <%= f.link_to_add "add", :ItemColors %> <%= f.actions %> <% end %> to create a new Item okay creates and throws On the New Item, but if I do update an existing item is routed to an error occurs while such a path exists: No route matches [PUT] "/admin/items.150" #150 is item_id rake routes: batch_action_admin_items POST /admin/items/batch_action(.:format) admin/items#batch_action admin_items GET /admin/items(.:format) admin/items#index POST /admin/items(.:format) admin/items#create new_admin_item GET /admin/items/new(.:format) admin/items#new edit_admin_item GET /admin/items/:id/edit(.:format) admin/items#edit admin_item GET /admin/items/:id(.:format) admin/items#show PUT /admin/items/:id(.:format) admin/items#update DELETE /admin/items/:id(.:format) admin/items#destroy help to solve this problem UPD I found the error, but not yet understood how to fix it the upgrade is a request: PUT "/admin/items" but should: PUT "/admin/items/some_id" any ideas?

    Read the article

  • jQuery Templates - XHTML Validation

    - by hajan
    Many developers have already asked me about this. How to make XHTML valid the web page which uses jQuery Templates. Maybe you have already tried, and I don't know what are your results but here is my opinion regarding this. By default, Visual Studio.NET adds the xhtml1-transitional.dtd schema <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> So, if you try to validate your page which has jQuery Templates against this schema, your page won't be XHTML valid. Why? It's because when creating templates, we use HTML tags inside <script> ... </script> block. Yes, I know that the script block has type="text/html" but it's not supported in this schema, thus it's not valid. Let's try validate the following code Code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>jQuery Templates :: XHTML Validation</title>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>          <script language="javascript" type="text/javascript">         $(function () {             var attendees = [                 { Name: "Hajan", Surname: "Selmani", speaker: true, phones: [070555555, 071888999, 071222333] },                 { Name: "Denis", Surname: "Manski", phones: [070555555, 071222333] }             ];             $("#myTemplate").tmpl(attendees).appendTo("#attendeesList");         });     </script>     <script id="myTemplate" type="text/html">          <li>             ${Name} ${Surname}             {{if speaker}}                 (<font color="red">speaks</font>)             {{else}}                 (attendee)             {{/if}}         </li>     </script>      </head>     <body>     <ol id="attendeesList"></ol> </body> </html> To validate it, go to http://validator.w3.org/#validate_by_input and copy paste the code rendered on client-side browser (it’s almost the same, only the template is rendered inside OL so LI tags are created for each item). Press CHECK and you will get: Result: 1 Errors, 2 warning(s)  The error message says: Validation Output: 1 Error Line 21, Column 13: document type does not allow element "li" here <li> Yes, the <li> HTML element is not allowed inside the <script>, so how to make it valid? FIRST: Using <![CDATA][…]]> The first thing that came in my mind was the CDATA. So, by wrapping any HTML tag which is in script blog, inside <![CDATA[ ........ ]]> it will make our code valid. However, the problem is that the template won't render since the template tags {} cannot get evaluated if they are inside CDATA. Ok, lets try with another approach. SECOND: HTML5 validation Well, if we just remove the strikethrough part bellow of the !DOPCTYPE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> our template is going to be checked as HTML5 and will be valid. Ok, there is another approach I've also tried: THIRD: Separate template to an external file We can separate the template to external file. I didn’t show how to do this previously, so here is the example. 1. Add HTML file with name Template.html in your ASPX website. 2. Place your defined template there without <script> tag Content inside Template.html <li>     ${Name} ${Surname}     {{if speaker}}         (<font color="red">speaks</font>)     {{else}}         (attendee)     {{/if}} </li> 3. Call the HTML file using $.get() jQuery ajax method and render the template with data using $.tmpl() function. $.get("/Templates/Template.html", function (template) {     $.tmpl(template, attendees).appendTo("#attendeesList"); }); So the complete code is: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head>     <title>jQuery Templates :: XHTML Validation</title>     <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script>     <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.js" type="text/javascript"></script>          <script language="javascript" type="text/javascript">         $(function () {             var attendees = [                 { Name: "Hajan", Surname: "Selmani", speaker: true, phones: [070555555, 071888999, 071222333] },                 { Name: "Denis", Surname: "Manski", phones: [070555555, 071222333] }             ];             $.get("/Templates/Template.html", function (template) {                 $.tmpl(template, attendees).appendTo("#attendeesList");             });         });     </script>      </head>     <body>     <ol id="attendeesList"></ol> </body> </html> This document was successfully checked as XHTML 1.0 Transitional! Result: Passed If you have any additional methods for XHTML validation, you can share it :). Thanks,Hajan

    Read the article

  • Wrap all created li-elments after click

    - by user317919
    $('input[name="iplus"]').click(function() { $("#billsumary").append("<li>Test</li>"); }); Hi, i append a li-elemnt on every click. Now I like to wrap all those created li-elements into an ol-element but not each created one but all of them together. sample html output: <div id='billsumary'> <ol> <li>Test</li> <li>Test</li> <li>Test</li> ... <li>Test</li> </ol> </div>

    Read the article

  • Problems with a from CSS

    - by Michael
    I am trying to create a fairly basic form with in my maincontent. I am sure I am coding things incorrectly and it is driving me crazy. Note my code. I get extremely wide vertical spacing in IE 7 and the bacground color between the field sets does not work correctly. All is good in FF. My CSS is: fieldset { margin: 1.5em 0 0 0; padding: 0; border-style: none; border-top: 1px solid #BFBAB0; background-color: #FFFFFF; } legend { margin-left: 1em; color: #000000; font-weight: bold; } fieldset ol { padding: 1em 1em 0 1em; list-style: none; } fieldset li { padding-bottom: 1em; } fieldset.submit { border-style: none; } { var w = document.myform.mylist.selectedIndex; var selected_text = document.myform.mylist.options[w].text; alert(selected_text); } label em { display: block; color: #900; font-size: 85%; font-style: normal; text-transform: uppercase; } This is my html code. <div id="mainContent1"> <form name="myform"> <label for="mylist"><strong>Select an Account Type:</strong></label> <select name="mylist"><option value="traditional">Traditional Account</option> <option value="paperless">Paperless Account</option> </select> </form> <br /><a> </a> <form action="example.php"> <fieldset> <legend>Contact Details</legend> <ol> <li> <label for="name">Name:</label> <input id="name" name="name" class="text" type="text" /> <label for="name"> <em>required</em> </label> </li> <li> <label for="email">Email address:</label> <input id="email" name="email" class="text" type="text" /> <label for="name"> <em>required</em> </li> <li> <label for="phone">Telephone:</label> <input id="phone" name="phone" class="text" type="text" /> <label for="name"> <em>required</em> <ol> <li> <input id="option1" name="option1" class="checkbox" type="checkbox" value="1" /> <label for="option1">Savings</label> </li> <li> <input id="option2" name="option2" class="checkbox" type="checkbox" value="1" /> <label for="option2">Checkings</label> </li> </ol> </fieldset> <fieldset> <legend>Delivery Address</legend> <ol> <li> <label for="address1">Address 1:</label> <input id="address1" name="address1" class="text" type="text" /> </li> <li> <label for="city">City:</label> <input id="city" name="city" class="text" type="text" /> </li> <li> <label for="postcode">Zip Code:</label> <input id="postcode" name="postcode" class="text textSmall" type="text" /> </li> <li> <label for="country">Country:</label> <input id="country" name="country" class="text" type="text" /> </li> </ol> </fieldset> <fieldset class="submit"> <input class="submit" type="submit" value="Submit" /> </fieldset> <fieldset class="clear"> <input class="clear" type="clear" value="Submit" /> </fieldset> </form>

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >