Jump to content

makata

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by makata

  1. The following line does not work. $("label[for=pick] .ui-btn-text").html("new label"); JS Bin - Collaborative JavaScript Debugging How to correct this?
  2. I have tested it. Does not work at all on my windows 7 machine.
  3. Hi I need a tool to generate flow chart from the code I write in html5 + javascript + jquerymobile. Do you know of a reliable tool?
  4. I want to replace $('#topspeed').change(function(){with a condition, something like if($("[id=topspeed]").....How to do it? Here's the HTML <select id="topspeed" ><option data-icon="arrow-u" data-iconpos="top" >- SELECT -</option ></select>
  5. The meaning of this.id is self explanatory: element with currently focused on ID, but due to the abundance of the word "this", it is very difficult to find it in online js references, like w3schools. could someone post a link to the explanation of this id somewhere on the net? ** It will help me deal with a specific problem. The problem is how to replace "this.id" with specific id reference. To narrow down my question, what does this.id refer to in the particular instances below and how could reference to it be made more directly, something like replacethisses="#particularID"? Copy code var itemlista1;var itemlista2; var mapa1 = { item1zest1 : itemlista1, item1zest2 : itemlista2 }; $('#item1zest1, #item1zest2').change(function(){$("#wybierzitem1 option").remove();[COLOR="Red"]$.each(mapa1[this.id], function(i, val) {[/COLOR]var opcja = $("<option />");chayn1 = valvar cutted=chayn1.split("|");var singl=cutted.slice(0,1);opcja.appendTo($("#wybierzitem1")).text(singl);$('#wybierzitem1').trigger("change")}); var versionesel = $("#wybierzitem1");var droplista = Math.floor(Math.random() * $('#wybierzitem1 option').length); versionesel.get(0).selectedIndex = droplista; versionesel.selectmenu('refresh', true);var itemwybrany = $('#wybierzitem1').val(); [COLOR="Green"] versioneFOR1=(mapa1[this.id][droplista]); [/COLOR] $("label[for='itempick1'] .ui-btn-text").html(itemwybrany);}); $('#wybierzitem1').change(function(){ var itemwybrany = $('#wybierzitem1').val(); $("label[for='itempick1'] .ui-btn-text").html(itemwybrany);var itemwybrakowany = $('#wybierzitem1')[0].selectedIndex;
  6. http://jsfiddle.net/tearex/mXQqP/ I have hit the wall on a trivial as i think problem. I can not replicate assignment of a variable in a different place of the code. Here is how the prototype works: first click one of the randomizers. they populate the select menu. then click the button. it makes the choice of the select menu appear on the diagnostic display. so far so good. now, click the select menu and choose something other than what is chosen the button will update, but upon pressing the button, a few lines of code are missing Here is how I see the problem. when the choice of the select menu item is randomized, the variable versioneFOR1 is assigned the content of the selected array element this way: versioneFOR1=(mapa1[this.id][droplista]); In the mirror process, when the choice of the array element is done not through randomization but by the user choice of dropdown menu, this.id does not seem to work. the variable needs to be defined otherwise. I feel the answer to this is simple, but I have hit the wall. please help
  7. I guess you are right. I will.
  8. There are five sets of text data in variables named in the following pattern:var1_1var1_2...var1_5 var2_1......var5_5 depending on which of five radiobuttons is checked, variables chosen1...chosen5 should be assigned the data from one of the five sets. Is there a way to simplify this process, rathen than if radiobu1 checked then chosen1=var1_1 chosen2=var1_2etc ?
  9. When creating alternvative or derivative versions of html+js files, I notice a lack of a consistent strategy for naming the names, classes and ids. the consequence is that when I try to integrate those files which started to live a life of their own, I spend a lot of time unifying the mentioned identifiers. As i do this, I still feel at a loss of a uniform system. do you have any? Ideally, the name should be telling of the function and class of the element, be distinct from the commands and words appearing on the GUI. Any other guidelines?
  10. Hi I have a hunch that something like that shoul already exist, but it is a matter of the right search - so far unsuccessful. I am looking for an e-learning platform, which enables placing html and jquery content online, possibly with a distinction between logged and unlogged users. are there solutions for doing that on your own website, (something like what wordpress enables for websites)?
  11. http://jsfiddle.net/tearex/JjRLf/2/ how to adapt the code to jqm?
  12. not that the problem is advanced, but the fact, that the code probably features a minor error http://jsbin.com/apudev/9/edit what it does is randomly picks a car from one of two lists chosen by the user. the only thing is that the choice does not get reflected in the select field. so the four lines lines var select = document.getElementById('s1');var items = select.getElementsByTagName('option');var index= Math.floor(Math.random() * items.length);select.selectedIndex = index; which elsewhere would work do not fit in the rest. what could be wrong?
  13. http://jsbin.com/azipok/2/edit this piece of code does the trick of clearing up the option list of select menu and adding a "test" message, but this message becomes visible only upon dropping down the select menu. is there a way to make this "test" message display and replace the "no modules..." text upon clicking the button?
  14. what needed changing was the values from 1 vs 2 to on vs off. the proper piece of code is: <form name="BRAND" ><select data-role="slider" name="MODEL" ><option value="off">sedan</option><option value="on"> sportster</option></select> </form> consequently, the js needs to follow. from {for (ll=0;ll<document.BRAND.MODEL.length;ll++){if (document.BRAND.MODEL[ll].checked){MODEL=eval(ll+1)}}if (MODEL==1) {KIND="sedan"}if (MODEL==2) {KIND="sportster"} it should turn into if (document.BRAND.MODEL.value=="off") {KIND="sedan"}if (document.BRAND.MODEL.value=="on") {KIND="sportster"} here is the problems which follows:http://w3schools.invisionzone.com/index.php?showtopic=46567
  15. in jqm, this is a working toggle switch: <form name="BRAND" ><select data-role="slider" name="MODEL" id="test"><option value="off">sedan</option><option value="on"> sportster</option></select> </form> and this is a way of making the switch trigger a function $( ".selector" ).on( 'slidestop', function( event ) { ... }); how to connect them? I have tried using this <script>$( ".selector" ).on( 'slidestop', myFunction()) function myFunction()document.write("works!")</script> and this $( "#testo" ).on( 'slidestop', myFunction())function myFunction()document.write("works!"); the former works before triggering, and the latter, where i try to connect the event to more specifically a switch with id="testo", it never works.
  16. Hello everybody. I have a formal question aren't the following identical for js? I am trying to replace radiobuttons with what in normal html manifests as a dropdown menu and what in jqm is a flip switch, but it does not work that way. what could be the reason? <form name="BRAND" ><input type="radio" name="MODEL" value="1" checked /><input type="radio" name="MODEL"value="2" /></form> <form name="BRAND" ><select data-role="slider" name="MODEL" ><option value="1">sedan</option><option value="2"> sportster</option></select> </form>
×
×
  • Create New...