Guest User

Untitled

a guest
Jan 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. <td class="m1234Bottom" style="width:35%;">
  2. <span id="ABC123" class="Datetime">
  3. <div class="dateElement" id="ABC188c">
  4. <input name="ABC$123ccc"
  5. type="text">
  6. <a class="date"></a>
  7. <a style="display: none;" class="time"></a>
  8. </div>
  9. </span>
  10. </td>
  11.  
  12. <td class="m1234Bottom" style="width:35%;">
  13. <span id="ABC123">
  14. 12/23/2012
  15. </span>
  16. </td>
  17.  
  18. $("input[name*='123ccc']".each(function() {
  19. var outv= $(this).val();
  20. alert(outv);
  21. });
  22.  
  23. var span = $('#ABC123');
  24.  
  25. //check if span has input child
  26. if (span.find('input').length > 0) {
  27. //get value from input field
  28. var date = span.find('input').val();
  29. }
  30. else {
  31. //get text date from the span
  32. var date = span.text();
  33. }
  34.  
  35. $(function() {
  36. $('#ABC123').find('input').length > 0 ? value = $('#ABC123').find('input').val() : value = $('#ABC123').text();
  37. console.log(value);
  38. });​
  39.  
  40. function retrieveValue()
  41. {
  42. // Retrieve the element (not guess yet)
  43. var spanOrInput = $("#ABCD123");
  44.  
  45. // Try to guess if its an input or a span
  46. var type = spanOrInput.attr('type');
  47. if (typeof type == "undefined" || !type)
  48. return spanOrInput.val();
  49. else
  50. return spanOrInput.html();
  51. }
  52.  
  53. <input type="hidden" id="hidtype" />
  54.  
  55. $(function(){
  56. if ($('#hidtype').val() == '1') { //or what ever you use to set state
  57. // code here for that mode
  58. }
  59. else{
  60. // code for other type of mode
  61. }
  62. });
  63.  
  64. if( $('#ABC123 input').length ) {
  65. //this means the input exists - handle from here
  66. }
Add Comment
Please, Sign In to add comment